/* MatchMate – tennis match management */
:root {
    --matchmate-cardcolor-1: #D6E4FF;
    --matchmate-cardcolor-2: #E8F0FE;
    --matchmate-cardcolor-3: #C9D6FF;
    --matchmate-cardcolor-4: #E0D7FF;
    --matchmate-cardcolor-5: #F0E9FF;
    --matchmate-cardcolor-6: #EADCF8;
    --matchmate-cardcolor-7: #F5E6FF;
    --matchmate-cardcolor-8: #E3EAF5;
    --matchmate-cardcolor-9: #DDE4EB;
    --matchmate-cardcolor-10: #F2F4F7;
    --matchmate-cardcolor-11: #E8EEF3;
    --matchmate-cardcolor-12: #D7E8E8;
    --matchmate-cardcolor-13: #CFE5F2;
    --matchmate-cardcolor-14: #DDE7FA;
    --matchmate-cardcolor-15: #E9E3F1;
    --matchmate-cardcolor-16: #F3EAF2;
    --matchmate-cardcolor-17: #E6E6FA;
    --matchmate-cardcolor-18: #D0D8E2;
    --matchmate-cardcolor-19: #CCD6DD;
    --matchmate-cardcolor-20: #E4E8F0;
}

.matchmate-cardcolor-1 {
    background-color: var(--matchmate-cardcolor-1);
}

.matchmate-cardcolor-2 {
    background-color: var(--matchmate-cardcolor-2);
}

.matchmate-cardcolor-3 {
    background-color: var(--matchmate-cardcolor-3);
}

.matchmate-cardcolor-4 {
    background-color: var(--matchmate-cardcolor-4);
}

.matchmate-cardcolor-5 {
    background-color: var(--matchmate-cardcolor-5);
}

.matchmate-cardcolor-6 {
    background-color: var(--matchmate-cardcolor-6);
}

.matchmate-cardcolor-7 {
    background-color: var(--matchmate-cardcolor-7);
}

.matchmate-cardcolor-8 {
    background-color: var(--matchmate-cardcolor-8);
}

.matchmate-cardcolor-9 {
    background-color: var(--matchmate-cardcolor-9);
}

.matchmate-cardcolor-10 {
    background-color: var(--matchmate-cardcolor-10);
}

.matchmate-cardcolor-11 {
    background-color: var(--matchmate-cardcolor-11);
}

.matchmate-cardcolor-12 {
    background-color: var(--matchmate-cardcolor-12);
}

.matchmate-cardcolor-13 {
    background-color: var(--matchmate-cardcolor-13);
}

.matchmate-cardcolor-14 {
    background-color: var(--matchmate-cardcolor-14);
}

.matchmate-cardcolor-15 {
    background-color: var(--matchmate-cardcolor-15);
}

.matchmate-cardcolor-16 {
    background-color: var(--matchmate-cardcolor-16);
}

.matchmate-cardcolor-17 {
    background-color: var(--matchmate-cardcolor-17);
}

.matchmate-cardcolor-18 {
    background-color: var(--matchmate-cardcolor-18);
}

.matchmate-cardcolor-19 {
    background-color: var(--matchmate-cardcolor-19);
}

.matchmate-cardcolor-20 {
    background-color: var(--matchmate-cardcolor-20);
}



/* Tekstfarge tilpasses bakgrunn via CSS-variabler; støtter lys og mørk tema */
.matchmate {
    --matchmate-gutter: 0.5rem;
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0 0 3rem;
    min-height: 1px;
    overflow-x: hidden;
    background: transparent;
    --matchmate-text: #1e293b;
    --matchmate-text-muted: #475569;
    --matchmate-text-subtle: #64748b;
    --matchmate-invite-bg: rgba(255, 255, 255, 0.6);
    /* Deaktivert knapp: flat nøytral – skiller seg tydelig fra aktive gradient-knapper */
    --matchmate-btn-disabled-bg: #e2e8f0;
    --matchmate-btn-disabled-fg: #64748b;
    --matchmate-btn-disabled-border: rgba(15, 23, 42, 0.12);
    color: var(--matchmate-text);
}

.matchmate > .matchmate-msg {
    margin-inline: max(var(--matchmate-gutter), env(safe-area-inset-left, 0px)) max(var(--matchmate-gutter), env(safe-area-inset-right, 0px));
}

/* PC: litt luft på sidene; mobil beholder full bredde */
@media (min-width: 768px) {
    .matchmate {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-inline: 1.25rem;
        --matchmate-gutter: 0.75rem;
    }

    .matchmate > .matchmate-msg {
        margin-inline: 0;
    }
}

/* Mørk bakgrunn: lys tekst */
@media (prefers-color-scheme: dark) {
    .matchmate {
        --matchmate-text: #e2e8f0;
        --matchmate-text-muted: #cbd5e1;
        --matchmate-text-subtle: #94a3b8;
        --matchmate-card-bg: #1e293b;
        --matchmate-border: #334155;
        --matchmate-input-bg: #0f172a;
        --matchmate-invite-bg: rgba(30, 41, 59, 0.8);
        --matchmate-btn-disabled-bg: #334155;
        --matchmate-btn-disabled-fg: #94a3b8;
        --matchmate-btn-disabled-border: rgba(226, 232, 240, 0.12);
    }
}

/* Oqtane/tema med mørk bakgrunn (klasse på body/html) */
[data-theme="dark"] .matchmate,
.theme-dark .matchmate,
.oqtane-dark .matchmate {
    --matchmate-text: #e2e8f0;
    --matchmate-text-muted: #cbd5e1;
    --matchmate-text-subtle: #94a3b8;
    --matchmate-card-bg: #1e293b;
    --matchmate-border: #334155;
    --matchmate-input-bg: #0f172a;
    --matchmate-invite-bg: rgba(30, 41, 59, 0.8);
    --matchmate-btn-disabled-bg: #334155;
    --matchmate-btn-disabled-fg: #94a3b8;
    --matchmate-btn-disabled-border: rgba(226, 232, 240, 0.12);
}

/* Invitasjonsvisning, utilgjengelige datoer og turneringsdetaljer: tekst på lesbar bakgrunn – lysere på mørk, mørkere på lys */
.matchmate-invite,
.matchmate-invitations,
.matchmate-unavailable,
.matchmate-tournament-detail {
    background: var(--matchmate-invite-bg);
    padding-block: 1rem;
    padding-inline: max(var(--matchmate-gutter), env(safe-area-inset-left, 0px)) max(var(--matchmate-gutter), env(safe-area-inset-right, 0px));
    border-radius: 0;
    border: 1px solid var(--matchmate-border, rgba(0, 0, 0, 0.08));
    border-left-width: 0;
    border-right-width: 0;
}

/* Lys bakgrunn under invitasjon, utilgjengelige datoer og turneringsdetaljer: mørk tekst */
.matchmate-invite,
.matchmate-invitations,
.matchmate-unavailable,
.matchmate-tournament-detail {
    color: var(--matchmate-text);
}

/* Mørk bakgrunn: invitasjonsseksjon, utilgjengelige datoer, turneringsdetaljer og opprett/edit får lys tekst */
@media (prefers-color-scheme: dark) {
    .matchmate-invite,
    .matchmate-invitations,
    .matchmate-unavailable,
    .matchmate-tournament-detail,
    .matchmate-section {
        --matchmate-text: #e2e8f0;
        --matchmate-text-muted: #cbd5e1;
        --matchmate-text-subtle: #94a3b8;
    }
}

[data-theme="dark"] .matchmate-invite,
[data-theme="dark"] .matchmate-invitations,
[data-theme="dark"] .matchmate-unavailable,
[data-theme="dark"] .matchmate-tournament-detail,
[data-theme="dark"] .matchmate-section,
.theme-dark .matchmate-invite,
.theme-dark .matchmate-invitations,
.theme-dark .matchmate-unavailable,
.theme-dark .matchmate-tournament-detail,
.theme-dark .matchmate-section,
.oqtane-dark .matchmate-invite,
.oqtane-dark .matchmate-invitations,
.oqtane-dark .matchmate-unavailable,
.oqtane-dark .matchmate-tournament-detail,
.oqtane-dark .matchmate-section {
    --matchmate-text: #e2e8f0;
    --matchmate-text-muted: #cbd5e1;
    --matchmate-text-subtle: #94a3b8;
}

.matchmate-hero {
    text-align: center;
    padding-block: 1.25rem;
    padding-inline: max(var(--matchmate-gutter), env(safe-area-inset-left, 0px)) max(var(--matchmate-gutter), env(safe-area-inset-right, 0px));
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 25%, #115e59 50%, #134e4a 75%, #14532d 100%);
    color: #fff !important;
    border-radius: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.matchmate-hero-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
}

.matchmate-hero-icon {
    margin-bottom: 0;
    opacity: 0.95;
    color: #fff;
}

/* Kompakt hero når kun ikon + tittel (ikke landingsside) */
.matchmate-hero:not(:has(.matchmate-hero-subtitle)) {
    padding-block: 0.75rem;
}

@media (min-width: 576px) {
    .matchmate-hero {
        padding-block: 2rem 1.5rem;
        margin-bottom: 2rem;
    }

        .matchmate-hero:not(:has(.matchmate-hero-subtitle)) {
            padding-block: 0.875rem;
        }
}

.matchmate-hero-icon svg {
    display: inline-block;
    vertical-align: middle;
}

.matchmate-hero-tennisball__ball {
    fill: #d4ef3c;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 1.15;
}

.matchmate-hero-tennisball__seam {
    fill: none;
    stroke: #fff;
    stroke-width: 1.4;
    stroke-linecap: round;
}

.matchmate-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@media (min-width: 576px) {
    .matchmate-hero-title {
        font-size: 2rem;
    }
}

.matchmate-hero-subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0.75rem 0 1rem;
    color: #fff !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

@media (min-width: 576px) {
    .matchmate-hero-subtitle {
        font-size: 1.1rem;
        margin: 0.75rem 0 1.25rem;
    }
}

.matchmate-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

/* Invitasjoner-menypunkt: tekst + pill med antall aktive (ikke utløpte) invitasjoner */
.matchmate-badge--with-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.matchmate-hero-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    background: #dc2626;
    color: #fff !important;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.matchmate-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.3);
    color: #fff !important;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.matchmate-badge--clickable {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

    .matchmate-badge--clickable:hover:not(:disabled):not([disabled]) {
        background: rgba(255, 255, 255, 0.5) !important;
    }

    .matchmate-badge--clickable.matchmate-badge--active:not(:disabled):not([disabled]) {
        background: rgba(255, 255, 255, 0.6) !important;
        box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8);
    }

/* Navigasjonsbadges (Dashboard): samme deaktiverte uttrykk som matchmate-btn */
button.matchmate-badge.matchmate-badge--clickable:disabled,
button.matchmate-badge.matchmate-badge--clickable[disabled] {
    cursor: not-allowed;
    background: var(--matchmate-btn-disabled-bg, #e2e8f0) !important;
    color: var(--matchmate-btn-disabled-fg, #64748b) !important;
    text-shadow: none;
    box-shadow: inset 0 0 0 1px var(--matchmate-btn-disabled-border, rgba(15, 23, 42, 0.12)) !important;
    filter: none !important;
    opacity: 1;
}

button.matchmate-badge.matchmate-badge--clickable:disabled:hover,
button.matchmate-badge.matchmate-badge--clickable:disabled:focus,
button.matchmate-badge.matchmate-badge--clickable[disabled]:hover,
button.matchmate-badge.matchmate-badge--clickable[disabled]:focus {
    background: var(--matchmate-btn-disabled-bg, #e2e8f0) !important;
    color: var(--matchmate-btn-disabled-fg, #64748b) !important;
    filter: none !important;
    box-shadow: inset 0 0 0 1px var(--matchmate-btn-disabled-border, rgba(15, 23, 42, 0.12)) !important;
}

@media (min-width: 576px) {
    .matchmate-badge {
        font-size: 0.9rem;
        padding: 0.35rem 0.85rem;
    }
}

.matchmate-card-menu-view {
    position: relative;
}

.matchmate-section {
    margin-bottom: 1.5rem;
    background: var(--matchmate-invite-bg);
    padding-block: 1rem;
    padding-inline: max(var(--matchmate-gutter), env(safe-area-inset-left, 0px)) max(var(--matchmate-gutter), env(safe-area-inset-right, 0px));
    border-radius: 0;
    border: 1px solid var(--matchmate-border, rgba(0, 0, 0, 0.08));
    border-left-width: 0;
    border-right-width: 0;
    color: var(--matchmate-text);
}

    /* Opprett-/rediger-skjema: én kolonne, innhold venstrestilt */
    .matchmate-section .matchmate-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    /* Ledetekster (labels) i Opprett/Edit – sikrer synlighet */
    .matchmate-section .matchmate-form-group label {
        display: block !important;
        font-weight: 500;
        margin-bottom: 0.35rem;
        color: var(--matchmate-text) !important;
        opacity: 1;
    }

    /* Toggle-rader: behold flex, ikke block (overstyrer regelen over) */
    .matchmate-section .matchmate-form-group label.matchmate-switch {
        display: inline-flex !important;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0;
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .matchmate-section .matchmate-form-group label.matchmate-switch .matchmate-switch-label {
        white-space: normal;
    }

@media (min-width: 576px) {
    .matchmate-section {
        margin-bottom: 2rem;
    }
}

.matchmate-section-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    width: 100%;
}

    .matchmate-section-header .matchmate-section-title {
        margin-bottom: 0;
    }

.matchmate-section-filter-hint {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--matchmate-text-muted);
    margin: 0.2rem 0 0 0;
    line-height: 1.3;
}

.matchmate-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
    color: var(--matchmate-text-muted);
    flex-shrink: 0;
    margin-left: auto;
}

    .matchmate-switch input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

.matchmate-switch-slider {
    position: relative;
    display: inline-block;
    width: 2.5rem;
    height: 1.25rem;
    background: var(--matchmate-border, #cbd5e1);
    border-radius: 1.25rem;
    transition: background 0.2s;
}

    .matchmate-switch-slider::before {
        content: "";
        position: absolute;
        height: 1rem;
        width: 1rem;
        left: 0.125rem;
        bottom: 0.125rem;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.2s;
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }

.matchmate-switch input:checked ~ .matchmate-switch-slider {
    background: #0d9488;
}

    .matchmate-switch input:checked ~ .matchmate-switch-slider::before {
        transform: translateX(1.25rem);
    }

.matchmate-switch-label {
    white-space: nowrap;
}

.matchmate-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--matchmate-text);
}

@media (min-width: 576px) {
    .matchmate-section-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

.matchmate-tournament-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 480px) {
    .matchmate-tournament-list {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .matchmate-tournament-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.matchmate-card {
    background: var(--matchmate-card-bg, #f2f2f2);
    border: 1px solid var(--matchmate-border, #dee2e6);
    border-radius: 0.7rem;
    height: 100%;
    transition: box-shadow 0.2s, border-color 0.2s;
    color: var(--matchmate-text);
}

.matchmate-card--tournament:hover,
.matchmate-card--action:hover {
    box-shadow: 0 0.5rem 1.25rem rgba(13, 148, 136, 0.15);
    border-color: #0d9488;
}

/* Eier av gruppen: grønn ramme rundt turneringskortet */
.matchmate-card--tournament.matchmate-card--owner {
    border-color: #16a34a;
    border-width: 3px;
}

.matchmate-card--tournament.matchmate-card--owner:hover {
    border-color: #15803d;
    box-shadow: 0 0.5rem 1.25rem rgba(22, 163, 74, 0.2);
}

[data-theme="dark"] .matchmate .matchmate-card--tournament.matchmate-card--owner,
.theme-dark .matchmate .matchmate-card--tournament.matchmate-card--owner,
.oqtane-dark .matchmate .matchmate-card--tournament.matchmate-card--owner {
    border-color: #4ade80;
}

[data-theme="dark"] .matchmate .matchmate-card--tournament.matchmate-card--owner:hover,
.theme-dark .matchmate .matchmate-card--tournament.matchmate-card--owner:hover,
.oqtane-dark .matchmate .matchmate-card--tournament.matchmate-card--owner:hover {
    border-color: #86efac;
    box-shadow: 0 0.5rem 1.25rem rgba(74, 222, 128, 0.18);
}

/* «Ny gruppe»-kort: samme høyde som turneringskort i grid, kompakt vertikal luft */
.matchmate-card--new-group.matchmate-card--clickable {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.matchmate-card-body.matchmate-card-body--new-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.85rem 1rem;
}

@media (min-width: 576px) {
    .matchmate-card-body.matchmate-card-body--new-group {
        padding: 1rem 1.5rem;
    }
}

.matchmate-card--new-group .matchmate-card-icon {
    margin-bottom: 0.3rem;
}

.matchmate-card--new-group .matchmate-card-icon + .matchmate-card-title {
    margin-bottom: 0.3rem;
}

.matchmate-card--new-group .matchmate-card-text {
    margin-bottom: 0.45rem;
    min-height: 0;
}

.matchmate-card--new-group .matchmate-card-text + .matchmate-card-title {
    margin-bottom: 0.2rem;
    margin-top: 0;
}

.matchmate-card--new-group .matchmate-card-subtext {
    margin-top: auto;
}

.matchmate-card--clickable {
    display: block;
    text-decoration: none;
}

.matchmate-card-body {
    padding: 1rem;
}

.matchmate-card {
    position: relative;
}

/* Utgått: gjennomsiktig tekst på skrå (gruppe- og aktivitetskort) */
.matchmate-expired-stamp {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.matchmate-expired-stamp__text {
    font-size: clamp(1rem, 4.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(40, 40, 40, 0.32);
    transform: rotate(-26deg);
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.matchmate-expired-stamp--cancelled .matchmate-expired-stamp__text {
    color: rgba(185, 28, 28, 0.38);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Utgått: samme stempelstil som kansellert, egen fargetone */
.matchmate-expired-stamp--expired .matchmate-expired-stamp__text {
    color: rgba(146, 64, 14, 0.4);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Utpublisert aktivitet (kun eier ser kortet) */
.matchmate-expired-stamp--not-active .matchmate-expired-stamp__text {
    color: rgba(71, 85, 105, 0.45);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Bane ikke booket (når gruppen krever booking) */
.matchmate-expired-stamp--court-not-booked .matchmate-expired-stamp__text {
    color: rgba(161, 98, 7, 0.42);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .matchmate .matchmate-expired-stamp--not-active .matchmate-expired-stamp__text,
.theme-dark .matchmate .matchmate-expired-stamp--not-active .matchmate-expired-stamp__text,
.oqtane-dark .matchmate .matchmate-expired-stamp--not-active .matchmate-expired-stamp__text {
    color: rgba(148, 163, 184, 0.5);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.matchmate-matchcard-wrapper .matchmate-expired-stamp {
    z-index: 2;
}

.matchmate-sf-dropdown,
.matchmate-sf-dropdown.e-input-group,
.matchmate-sf-dropdown.e-ddl {
    width: 100%;
    max-width: 100%;
}

.matchmate-card-divider {
    height: 1px;
    background: #ddd;
    margin:0.75rem 0;
}

.matchmate-matchcard > .matchmate-card-divider {
    flex-shrink: 0;
}
/* VENSTRE kant */
.matchmate-card-isinbooking::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: #047857;
}

/* HØYRE kant */
.matchmate-card-missingplayer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 4px;
    background: #f30707;
}

/* HØYRE kant */
.matchmate-card-courtnotbooked::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 4px;
    background: #eab308;
}


@media (min-width: 576px) {
    .matchmate-card-body {
        padding: 1.5rem;
    }
}

.matchmate-card-icon {
    margin-bottom: 0.75rem;
    color: #0d9488 !important;
}

.matchmate-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--matchmate-text);
}

@media (min-width: 576px) {
    .matchmate-card-title {
        font-size: 1.15rem;
    }
}

.matchmate-card-text {
    font-size: 0.875rem;
    color: var(--matchmate-text-muted);
    margin-bottom: 1rem;
    min-height: 2.5em;
}

.matchmate-card-subtext {
    font-size: 0.75rem;
    color: var(--matchmate-text-muted);
    margin: 0;
    margin-top: auto;
}

.matchmate-card-meta {
    font-size: 0.875rem;
    color: var(--matchmate-text-muted);
    margin-bottom: 0.25rem;
}

.matchmate-card-place {
    font-size: 0.8125rem;
    color: var(--matchmate-text-muted);
    margin-bottom: 1rem;
}

.matchmate-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

    .matchmate-card-actions .matchmate-btn {
        vertical-align: middle;
    }

.matchmate-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--matchmate-text-subtle);
    margin-top: 0.25rem;
}

.matchmate-hints-compact .matchmate-hint {
    margin-bottom: 0;
}

.matchmate-hints-compact .matchmate-hint:first-child {
    margin-top: 0.25rem;
}

.matchmate-hints-compact .matchmate-hint + .matchmate-hint {
    margin-top: 0.08rem;
}

.matchmate-participant-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.35rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--matchmate-border, #d1d5db);
    border-radius: 0.375rem;
    background: var(--matchmate-input-bg, #fff);
    /* Alltid navn visuelt til venstre, hake til høyre (uavhengig av rtl på siden) */
    direction: ltr;
}

/* Må vinne over .matchmate-section .matchmate-form-group label { display: block !important } */
.matchmate-section .matchmate-form-group label.matchmate-participant-check {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    direction: ltr;
    width: 100%;
    margin-bottom: 0;
    font-weight: 400;
    color: var(--matchmate-text);
}

.matchmate-participant-check__name {
    min-width: 0;
    word-break: break-word;
    text-align: start;
    justify-self: start;
}

    .matchmate-section .matchmate-form-group label.matchmate-participant-check input[type="checkbox"] {
        justify-self: end;
        flex-shrink: 0;
        float: none;
        margin: 0;
    }

.matchmate-participant-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(7.25rem, auto) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    width: 100%;
    direction: ltr;
}

.matchmate-participant-row .matchmate-participant-check__name {
    font-size: 0.9rem;
    color: var(--matchmate-text);
    min-width: 0;
    word-break: break-word;
}

.matchmate-rank-select {
    width: 100%;
    max-width: 11rem;
    min-width: 7.25rem;
    font-size: 0.85rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.matchmate-rank-placeholder {
    min-width: 7.25rem;
    max-width: 11rem;
}

.matchmate-participant-row .matchmate-participant-check-cb {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    cursor: pointer;
}

.matchmate-participant-row .matchmate-participant-check-cb input[type="checkbox"] {
    margin: 0;
}

.matchmate-reserve-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.matchmate-reserve-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(7.25rem, auto) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    direction: ltr;
}

.matchmate-reserve-add {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.matchmate-reserve-add__icon {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1;
}

.matchmate-invite .matchmate-form-group,
.matchmate-unavailable .matchmate-form-group {
    margin-bottom: 1rem;
}

.matchmate-invite .form-control,
.matchmate-unavailable .form-control {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--matchmate-border, #d1d5db);
    border-radius: 0.375rem;
    font-size: 16px;
    box-sizing: border-box;
    background: var(--matchmate-input-bg, #fff);
    color: var(--matchmate-text);
}

    .matchmate-invite .form-control::placeholder,
    .matchmate-unavailable .form-control::placeholder {
        color: var(--matchmate-text-subtle);
    }

.matchmate-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    min-height: 44px;
    min-width: 44px;
    box-sizing: border-box;
    color: #fff !important;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    text-decoration: none;
    transition: filter 0.2s, box-shadow 0.2s;
    border: none;
    line-height: 1.4;
    text-align: center;
}

    .matchmate-btn:hover:not(:disabled):not([disabled]) {
        filter: brightness(1.1);
        color: #fff !important;
    }

.matchmate-btn--primary {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 50%, #115e59 100%);
}

    .matchmate-btn--primary:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(13, 148, 136, 0.35);
    }

.matchmate-btn--secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 50%, #334155 100%);
}

    .matchmate-btn--secondary:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(100, 116, 139, 0.35);
    }

.matchmate-btn--danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
}

    .matchmate-btn--danger:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(220, 38, 38, 0.35);
    }

.matchmate-btn--gray {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 50%, #475569 100%);
}

    .matchmate-btn--gray:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(100, 116, 139, 0.35);
    }

.matchmate-btn--green {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
}

    .matchmate-btn--green:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(34, 197, 94, 0.35);
    }

.matchmate-btn--yellow {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 50%, #a16207 100%);
}

    .matchmate-btn--yellow:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(234, 179, 8, 0.35);
    }

.matchmate-btn--blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
}

    .matchmate-btn--blue:hover:not(:disabled):not([disabled]) {
        box-shadow: 0 0.25rem 0.5rem rgba(59, 130, 246, 0.35);
    }

/* Deaktivert: ingen gradient, dempet tekst – gjelder alle knapper i modulen med matchmate-btn (+ varianter + submit) */
.matchmate-btn:disabled,
.matchmate-btn[disabled],
button.matchmate-btn:disabled,
button.matchmate-btn[disabled],
button[type="submit"].matchmate-btn:disabled,
button[type="submit"].matchmate-btn[disabled],
.matchmate .matchmate-btn:disabled,
.matchmate .matchmate-btn[disabled],
button.matchmate-btn.matchmate-btn--primary:disabled,
button.matchmate-btn.matchmate-btn--primary[disabled],
button.matchmate-btn.matchmate-btn--secondary:disabled,
button.matchmate-btn.matchmate-btn--secondary[disabled],
button.matchmate-btn.matchmate-btn--danger:disabled,
button.matchmate-btn.matchmate-btn--danger[disabled],
button.matchmate-btn.matchmate-btn--gray:disabled,
button.matchmate-btn.matchmate-btn--gray[disabled],
button.matchmate-btn.matchmate-btn--green:disabled,
button.matchmate-btn.matchmate-btn--green[disabled],
button.matchmate-btn.matchmate-btn--yellow:disabled,
button.matchmate-btn.matchmate-btn--yellow[disabled],
button.matchmate-btn.matchmate-btn--blue:disabled,
button.matchmate-btn.matchmate-btn--blue[disabled],
button.matchmate-btn.matchmate-btn--sm:disabled,
button.matchmate-btn.matchmate-btn--sm[disabled],
button.matchmate-btn.matchmate-btn--icon:disabled,
button.matchmate-btn.matchmate-btn--icon[disabled] {
    cursor: not-allowed;
    background: var(--matchmate-btn-disabled-bg, #e2e8f0) !important;
    background-image: none !important;
    color: var(--matchmate-btn-disabled-fg, #64748b) !important;
    border: none;
    /* Inset-kant unngår layout-hopp sammenlignet med aktive knapper (border: none) */
    box-shadow: inset 0 0 0 1px var(--matchmate-btn-disabled-border, rgba(15, 23, 42, 0.12)) !important;
    filter: none !important;
    opacity: 1;
}

.matchmate-btn:disabled:hover,
.matchmate-btn:disabled:focus,
.matchmate-btn:disabled:focus-visible,
.matchmate-btn[disabled]:hover,
.matchmate-btn[disabled]:focus,
.matchmate-btn[disabled]:focus-visible,
button.matchmate-btn:disabled:hover,
button.matchmate-btn:disabled:focus,
button.matchmate-btn:disabled:focus-visible,
button.matchmate-btn[disabled]:hover,
button.matchmate-btn[disabled]:focus,
button.matchmate-btn[disabled]:focus-visible,
button[type="submit"].matchmate-btn:disabled:hover,
button[type="submit"].matchmate-btn[disabled]:hover {
    filter: none !important;
    box-shadow: inset 0 0 0 1px var(--matchmate-btn-disabled-border, rgba(15, 23, 42, 0.12)) !important;
    color: var(--matchmate-btn-disabled-fg, #64748b) !important;
    background: var(--matchmate-btn-disabled-bg, #e2e8f0) !important;
    background-image: none !important;
}

.matchmate-btn--sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.matchmate-btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem;
}

    .matchmate-btn--icon.matchmate-btn--sm {
        padding: 0.3rem;
        min-width: 32px;
        height: 32px;
    }

    .matchmate-btn--icon svg {
        flex-shrink: 0;
    }

/* Mine grupper: alle handlingsknapper i én flex-rad som bryter til venstre ved behov */
.matchmate-tournament-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.matchmate-btn--icon-label.matchmate-btn--sm {
    min-width: auto;
    height: auto;
    min-height: 32px;
    padding: 0.3rem 0.5rem;
}

.matchmate-cards {
    margin-bottom: 1.5rem;
}

@media (min-width: 576px) {
    .matchmate-cards {
        margin-bottom: 2.5rem;
    }
}

.matchmate-cards .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.matchmate-cards [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .matchmate-cards [class*="col-"] {
        margin-bottom: 0;
    }
}

.matchmate-features {
    margin-bottom: 1.5rem;
    padding-block: 1rem;
    padding-inline: max(var(--matchmate-gutter), env(safe-area-inset-left, 0px)) max(var(--matchmate-gutter), env(safe-area-inset-right, 0px));
    background: var(--matchmate-invite-bg);
    border: 1px solid var(--matchmate-border, rgba(0, 0, 0, 0.08));
    border-left-width: 0;
    border-right-width: 0;
    border-radius: 0;
    color: var(--matchmate-text);
}

@media (min-width: 576px) {
    .matchmate-features {
        margin-bottom: 2.5rem;
        padding-block: 1.5rem;
    }
}

.matchmate-feature-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

    .matchmate-feature-list li {
        padding: 0.35rem 0;
        padding-left: 1.5rem;
        position: relative;
        color: var(--matchmate-text-muted);
        opacity: 0.95;
    }

        .matchmate-feature-list li::before {
            content: "✓";
            position: absolute;
            left: 0;
            color: #0d9488;
            font-weight: bold;
        }

.matchmate-empty,
.matchmate-loading {
    color: var(--matchmate-text-muted);
    opacity: 0.95;
    padding: 1rem 0;
}

/* Match card */
.matchmate-matchcard-wrapper {
    position: relative;
    border: 1px solid var(--matchmate-border, #dee2e6);
    border-radius: 0.7rem;
    overflow: hidden;
    background: var(--matchmate-card-bg, #f2f2f2);
    color: var(--matchmate-text);
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.matchmate-matchcard-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
    pointer-events: none;
}

.matchmate-matchcard-overlay--q {
    font-size: 3rem;
    font-weight: 700;
    color: #fff !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@media (min-width: 480px) {
    .matchmate-matchcard-overlay--q {
        font-size: 4rem;
    }
}

.matchmate-matchcard-overlay--x {
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff !important;
    text-shadow: 0 0 0 3px #dc3545, 0 2px 4px rgba(0,0,0,0.5);
}

@media (min-width: 480px) {
    .matchmate-matchcard-overlay--x {
        font-size: 5rem;
    }
}

.matchmate-matchcard {
    padding: 0.75rem;
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

@media (min-width: 576px) {
    .matchmate-matchcard {
        padding: 1rem;
    }
}

.matchmate-matchcard--cancelled .matchmate-matchcard,
.matchmate-matchcard--incomplete .matchmate-matchcard {
    filter: brightness(0.95);
}

.matchmate-matchcard-header {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.matchmate-matchcard-header-line1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.25rem;
}

.matchmate-matchcard-date {
    font-weight: 600;
    color: var(--matchmate-text);
}

.matchmate-matchcard-type {
    font-weight: 600;
    color: var(--matchmate-text-muted);
    font-size: 0.9375rem;
}

.matchmate-matchcard-type::before {
    content: "·";
    margin-right: 0.25rem;
    color: var(--matchmate-text-subtle, #94a3b8);
}

.matchmate-matchcard-time {
    color: var(--matchmate-text-muted);
    font-size: 0.875rem;
}

.matchmate-matchcard-place {
    font-size: 0.875rem;
    color: var(--matchmate-text-muted);
}

.matchmate-matchcard-tournament {
    font-size: 0.875rem;
    color: var(--matchmate-text);
    margin-top: 0.25rem;
    font-weight: 600;
}

.matchmate-matchcard-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
    width: 100%;
    flex-shrink: 0;
}

.matchmate-matchcard-footer__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.matchmate-matchcard-footer__owner-run {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.matchmate-matchcard-footer__owner-ddl {
    flex: 1 1 10rem;
    min-width: 8rem;
    max-width: 100%;
}

.matchmate-owner-command-ddl {
    width: 100%;
}

.matchmate-card-command-select {
    flex: 1 1 10rem;
    min-width: 8rem;
    max-width: 100%;
    padding: 0.35rem 2rem 0.35rem 0.5rem;
    border-radius: 0.35rem;
    border: 1px solid var(--matchmate-border, #dee2e6);
    background-color: var(--matchmate-card-bg, #fff);
    color: var(--matchmate-text);
    font-size: 0.875rem;
    line-height: 1.3;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 12px;
}

.matchmate-tournament-owner-run {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.25rem;
}

/* Kontekstmeny på gruppe-/aktivitetskort (samme mønster som KS4) */
.matchmate-card-host,
.matchmate-matchcard-wrapper.matchmate-card-host {
    display: block;
    width: 100%;
    min-width: 0;
    -webkit-touch-callout: none;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.matchmate-card-host,
.matchmate-card-host *,
.matchmate-matchcard-wrapper.matchmate-card-host,
.matchmate-matchcard-wrapper.matchmate-card-host * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.matchmate-card-host ::selection,
.matchmate-matchcard-wrapper.matchmate-card-host ::selection,
.matchmate-card-host *::selection,
.matchmate-matchcard-wrapper.matchmate-card-host *::selection {
    background: transparent;
    color: inherit;
}

.matchmate-card-host--hold {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: 2px;
    border-radius: inherit;
}

/* Kontekstmeny – samme mønster som KS4 (fixed backdrop + panel) */
.matchmate-card-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: default;
}

.matchmate-card-menu {
    display: block;
    position: fixed;
    z-index: 10050;
    min-width: 12.5rem;
    max-width: min(18rem, calc(100vw - 1rem));
    max-height: min(
        calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1rem),
        calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1rem)
    );
    margin: 0;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    color: var(--matchmate-text, #1f2937);
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    overflow-y: auto;
}

.matchmate-card-menu__list {
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
}

.matchmate-card-menu__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.matchmate-card-menu__item:hover:not(:disabled),
.matchmate-card-menu__item:focus-visible:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
}

.matchmate-card-menu__item:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.matchmate-card-menu__list li,
.matchmate-card-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
}

[data-theme="dark"] .matchmate .matchmate-card-menu,
.theme-dark .matchmate .matchmate-card-menu,
.oqtane-dark .matchmate .matchmate-card-menu {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.14);
    color: #f3f4f6;
}

[data-theme="dark"] .matchmate .matchmate-card-menu-backdrop,
.theme-dark .matchmate .matchmate-card-menu-backdrop,
.oqtane-dark .matchmate .matchmate-card-menu-backdrop {
    background: transparent;
}

@media (max-width: 639.98px) {
    .matchmate-card-menu__item {
        min-height: 2.75rem;
        padding: 0.65rem 0.85rem;
    }
}

.matchmate-matchcard-edit {
    flex-shrink: 0;
}

.matchmate-matchcard-results {
    flex-shrink: 0;
}

.matchmate-matchcard-copy {
    flex-shrink: 0;
}

.matchmate-matchcard-delete {
    flex-shrink: 0;
}

/* AktivitetId QR-dialog (aktivitetskort) */
.matchmate-aktivitet-id-qr {
    text-align: center;
}

.matchmate-aktivitet-id-qr .matchmate-hint,
.matchmate-aktivitet-id-qr__label {
    text-align: center;
}

.matchmate-aktivitet-id-qr__code {
    margin: 0.35rem 0 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
    color: var(--matchmate-text, #111827);
}

.matchmate-aktivitet-id-qr__image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 0.75rem;
}

.matchmate-aktivitet-id-qr__image > * {
    margin-left: auto;
    margin-right: auto;
}

.matchmate-aktivitet-id-qr__url {
    margin: 0;
    font-size: 0.8rem;
    word-break: break-all;
    text-align: center;
    color: var(--matchmate-text-muted, #6b7280);
}

/* Poengsum fra trekning */
.matchmate-machresult-list {
    list-style: none;
    margin: 0.5rem 0 0 0;
    padding: 0;
    border: 1px solid var(--matchmate-border, #e5e7eb);
    border-radius: 0.375rem;
    overflow: hidden;
    background: var(--matchmate-input-bg, #fff);
}

.matchmate-machresult-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 1rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--matchmate-border, #e5e7eb);
    font-size: 0.9rem;
}

.matchmate-machresult-main {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 12rem;
}

.matchmate-machresult-place {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--matchmate-text-muted, #6b7280);
    min-width: 1.85rem;
}

.matchmate-machresult-row:last-child {
    border-bottom: none;
}

.matchmate-machresult-row:nth-child(even) {
    background: var(--matchmate-cardcolor-11, #f8fafc);
}

.matchmate-machresult-name {
    font-weight: 500;
    color: var(--matchmate-text, #111827);
    min-width: 0;
    word-break: break-word;
}

.matchmate-machresult-points {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--matchmate-text-muted, #4b5563);
    flex-shrink: 0;
}

.matchmate-machresult-summary {
    margin-bottom: 0.75rem;
}

.matchmate-machresult-average {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--matchmate-border, #e5e7eb);
}

.matchmate-machresult-average__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--matchmate-text, #111827);
}

.matchmate-machresult-average__hint {
    margin: 0 0 0.5rem;
}

.matchmate-machresult-average__values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    flex-shrink: 0;
}

.matchmate-machresult-average__detail {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--matchmate-text-subtle, #6b7280);
}

/* Aktivitetsdetaljer (trekning som egen visning) */
.matchmate-matchdetails-summary {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--matchmate-border, #e5e7eb);
    border-radius: 0.375rem;
    background: var(--matchmate-input-bg, #fff);
}

.matchmate-matchdetails-meta,
.matchmate-matchdetails-tournament {
    margin: 0 0 0.35rem 0;
    font-size: 0.9rem;
}

.matchmate-matchdetails-tournament {
    font-weight: 600;
    color: var(--matchmate-text);
}

.matchmate-matchdetails-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.matchmate-matchdetails-trekning {
    margin-top: 0.5rem;
}

.matchmate-matchdetails-trekning-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.matchmate-matchdetails-trekning-intro {
    margin: 0 0 0.5rem 0;
}

.matchmate-matchdetails-trekning-actions {
    margin-bottom: 0.75rem;
}

.matchmate-matchdetails-trekning-hint {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.matchmate-matchdetails-results {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--matchmate-border, #e5e7eb);
}

.matchmate-matchdetails-results__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--matchmate-text, #111827);
}

/* Trekning (kort / detaljvisning) */
.matchmate-draw-serve {
    color: #15803d;
    font-weight: 600;
}

[data-theme="dark"] .matchmate .matchmate-draw-serve,
.theme-dark .matchmate .matchmate-draw-serve,
.oqtane-dark .matchmate .matchmate-draw-serve {
    color: #4ade80;
}

.matchmate-trekning-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.matchmate-trekning-round-group {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--matchmate-border, #e5e7eb);
}

.matchmate-trekning-round-group:first-of-type {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: none;
}

.matchmate-trekning-round-group__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.35rem 0;
    color: var(--matchmate-text, #111827);
}

.matchmate-trekning-match {
    margin: 0.5rem 0;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--matchmate-border, #e5e7eb);
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.matchmate-trekning-match:last-child {
    border-bottom: none;
}

/* Bane | lag | resultat | handlinger: én linje (mobil og desktop) */
.matchmate-trekning-match__grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    min-width: 0;
}

.matchmate-trekning-match__slot {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex-shrink: 0;
}

.matchmate-trekning-match__court-value {
    font-weight: 600;
    color: var(--matchmate-text, #111827);
    white-space: nowrap;
    font-size: 0.82rem;
}

.matchmate-trekning-match__slot--court {
    flex: 0 0 auto;
    max-width: 5.5rem;
}

.matchmate-trekning-match__slot--lineup {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.matchmate-trekning-match__slot--result {
    flex: 0 0 auto;
}

.matchmate-trekning-match__lineup-body {
    min-width: 0;
    width: auto;
    overflow: hidden;
}

.matchmate-trekning-match__slot--lineup .matchmate-trekning-match-teams {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobil/tablet smal skjerm: to linjer – liste og tabell */
@media (max-width: 639.98px) {
    /* Liste: linje 1 = bane + navn, linje 2 = resultat + knapper (høyre) */
    .matchmate-trekning-list .matchmate-trekning-match__grid {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        flex-wrap: unset;
        align-items: center;
        gap: 0.2rem 0.4rem;
        overflow-x: visible;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--court {
        grid-column: 1;
        grid-row: 1;
        max-width: none;
        align-self: start;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--lineup {
        grid-column: 2;
        grid-row: 1;
        overflow: visible;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--lineup .matchmate-trekning-match-teams {
        white-space: normal;
        text-overflow: clip;
        overflow: visible;
    }

    .matchmate-trekning-list .matchmate-trekning-match__footer {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: center;
        gap: 0.35rem;
        width: 100%;
        min-width: 0;
    }

    .matchmate-trekning-list .matchmate-trekning-match__footer .matchmate-trekning-match__slot--result,
    .matchmate-trekning-list .matchmate-trekning-match__footer .matchmate-trekning-match__slot--actions {
        margin-left: 0;
        flex: 0 0 auto;
    }

    .matchmate-trekning-list .matchmate-trekning-match__footer .matchmate-trekning-match__line-actions--end {
        margin-left: 0;
    }

    .matchmate-trekning-list .matchmate-trekning-match__people-btn.matchmate-btn--sm,
    .matchmate-trekning-list .matchmate-trekning-match__delete-btn.matchmate-btn--sm {
        min-height: 2rem;
        min-width: 2rem;
        padding: 0.2rem;
    }

    /* Tabell: linje 1 = spillere, linje 2 = resultat + knapper (høyre) */
    .matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__footer {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .matchmate-trekning-grid .matchmate-trekning-results--gridcell {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .matchmate-trekning-grid .matchmate-trekning-results__input {
        font-size: 16px;
        min-height: 2rem;
        width: 2.75rem;
        padding: 0.15rem 0.3rem;
        box-sizing: border-box;
    }

    .matchmate-trekning-grid .matchmate-trekning-results__save.matchmate-btn--sm,
    .matchmate-trekning-grid .matchmate-trekning-match__people-btn.matchmate-btn--sm,
    .matchmate-trekning-grid .matchmate-trekning-match__delete-btn.matchmate-btn--sm {
        min-height: 2rem;
        min-width: 2rem;
        padding: 0.2rem;
        font-size: 0.75rem;
    }
}

/* Person-ikon etter «Lagre» i resultatraden: deltar i flex uten ekstra boks */
.matchmate-trekning-match__line-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.matchmate-trekning-match__line-actions--end {
    margin-left: auto;
}

.matchmate-trekning-match__cell-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: 100%;
    min-width: 0;
}

.matchmate-trekning-match__cell-row .matchmate-trekning-match__lineup-body {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
}

/* Tabellvisning: linje 1 = spillere, linje 2 = resultat + knapper (høyre) */
.matchmate-trekning-grid .matchmate-trekning-match__cell-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0.2rem 0;
}

.matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__lineup-body {
    grid-row: 1;
}

.matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__footer {
    grid-row: 2;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}

.matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__footer .matchmate-trekning-match__slot--result,
.matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__footer .matchmate-trekning-match__slot--actions {
    flex: 0 0 auto;
    margin-left: 0;
}

.matchmate-trekning-grid .matchmate-trekning-match__cell-row .matchmate-trekning-match__footer .matchmate-trekning-match__line-actions--end {
    margin-left: 0;
}

.matchmate-trekning-grid .matchmate-trekning-match__result-block {
    margin-top: 0;
}

.matchmate-trekning-match__slot--actions {
    flex: 0 0 auto;
    align-self: center;
}

.matchmate-trekning-match__roster-action--after-save {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.matchmate-trekning-match__footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

@media (min-width: 640px) {
    .matchmate-trekning-match__grid {
        column-gap: 0.75rem;
        row-gap: 0.35rem;
    }

    .matchmate-trekning-list .matchmate-trekning-match__footer {
        display: contents;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--result {
        margin-left: auto;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--actions:last-child {
        margin-left: auto;
    }

    .matchmate-trekning-list .matchmate-trekning-match__slot--result + .matchmate-trekning-match__slot--actions {
        margin-left: 0;
    }

    .matchmate-trekning-match__slot {
        gap: 0.45rem;
    }

    .matchmate-trekning-match__slot--court {
        max-width: none;
    }

    .matchmate-trekning-match__court-value {
        font-size: 0.9rem;
    }

    .matchmate-trekning-match__slot--lineup {
        flex: 1 1 10rem;
        min-width: min(100%, 12rem);
    }

    .matchmate-trekning-match__slot--lineup .matchmate-trekning-match-teams {
        white-space: normal;
        text-overflow: clip;
        overflow: visible;
    }

    .matchmate-trekning-results {
        font-size: 0.85rem;
        gap: 0.35rem;
    }

    .matchmate-trekning-results__input {
        width: 3.25rem;
        padding: 0.2rem 0.35rem;
        font-size: 0.85rem;
    }

    .matchmate-trekning-results__save.matchmate-btn--sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

.matchmate-trekning-match-teams {
    color: var(--matchmate-text);
}

.matchmate-matchdetails-trekning-result-intro {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
}

.matchmate-trekning-results {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.82rem;
}

.matchmate-trekning-results__input {
    width: 2.75rem;
    min-width: 0;
    padding: 0.15rem 0.25rem;
    font-size: 0.82rem;
    text-align: center;
}

.matchmate-trekning-results__save.matchmate-btn--sm {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    min-height: auto;
    line-height: 1.2;
}

.matchmate-trekning-results__sep {
    color: var(--matchmate-text-muted, #6b7280);
    user-select: none;
}

.matchmate-trekning-results__readonly {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.matchmate-trekning-results--with-save {
    flex-wrap: wrap;
}

.matchmate-trekning-results__calc.matchmate-btn--icon {
    flex-shrink: 0;
}

.matchmate-result-calc-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: var(--matchmate-input-bg, #fff);
}

.matchmate-result-calc.matchmate-result-calc--window {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    min-height: 100dvh;
    min-height: 100vh;
    overflow: hidden;
    padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--matchmate-input-bg, #fff);
}

.matchmate-result-calc__header {
    flex-shrink: 0;
    padding-bottom: 0.75rem;
}

.matchmate-result-calc__back {
    min-width: 7rem;
    min-height: 2.75rem;
    font-size: 1rem;
}

.matchmate-result-calc__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(0.75rem, 2.5vh, 1.5rem);
    min-height: 0;
    padding: 0.25rem 0;
}

.matchmate-result-calc__team {
    margin: 0;
    text-align: center;
    font-weight: 700;
    font-size: clamp(1.05rem, 4.5vw, 1.35rem);
    line-height: 1.3;
    color: var(--matchmate-text, #111827);
    word-break: break-word;
}

.matchmate-result-calc__team--top {
    flex-shrink: 0;
}

.matchmate-result-calc__team--bottom {
    flex-shrink: 0;
}

.matchmate-result-calc__steppers {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.matchmate-result-calc__step-btn {
    flex: 1 1 0;
    min-height: clamp(4.5rem, 14vh, 6.5rem);
    border: 2px solid var(--matchmate-border, #d1d5db);
    border-radius: 0.75rem;
    background: var(--matchmate-cardcolor-11, #f8fafc);
    color: var(--matchmate-text, #111827);
    font-size: clamp(2.75rem, 10vw, 4rem);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.matchmate-result-calc__step-btn:hover:not(:disabled) {
    background: var(--matchmate-cardcolor-12, #eef2ff);
    border-color: var(--matchmate-primary, #2563eb);
}

.matchmate-result-calc__step-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.matchmate-result-calc__step-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.matchmate-result-calc__scores {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2.5vh, 1.25rem);
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: center;
    min-height: 0;
    padding: 0.25rem 0;
    width: 100%;
    max-width: min(100%, 16rem);
    margin: 0 auto;
}

.matchmate-result-calc__score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    aspect-ratio: 1.35;
    max-height: min(28vh, 9rem);
    margin: 0 auto;
    padding: 0.75rem;
    border: 2px solid var(--matchmate-border, #cbd5e1);
    border-radius: 0.5rem;
    background: var(--matchmate-cardcolor-11, #f8fafc);
    box-sizing: border-box;
}

.matchmate-result-calc__score-box-label {
    font-size: clamp(0.75rem, 3vw, 0.9rem);
    font-weight: 600;
    color: var(--matchmate-text-muted, #6b7280);
    text-align: center;
    line-height: 1.2;
}

.matchmate-result-calc__score-digit {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.2em;
    font-size: clamp(3.25rem, 16vw, 5.5rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--matchmate-text, #111827);
    line-height: 1;
}

@media (min-width: 480px) {
    .matchmate-result-calc.matchmate-result-calc--window {
        max-width: 28rem;
        margin: 0 auto;
        border-left: 1px solid var(--matchmate-border, #e5e7eb);
        border-right: 1px solid var(--matchmate-border, #e5e7eb);
    }

    .matchmate-result-calc-overlay {
        background: rgba(15, 23, 42, 0.4);
    }
}

.matchmate-matchdetails-trekning-save {
    margin: 0.75rem 0 0 0;
}

.matchmate-trekning-vs {
    margin: 0 0.15rem;
}

/* Trekning – rutenett (runde ↓, bane →) */
@media print {
    body * {
        visibility: hidden !important;
    }

    .matchmate-matchdetails,
    .matchmate-matchdetails * {
        visibility: visible !important;
    }

    .matchmate-matchdetails {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0.5rem !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    .matchmate-matchdetails .matchmate-no-print {
        display: none !important;
    }

    .matchmate-matchdetails .matchmate-trekning-results,
    .matchmate-matchdetails .matchmate-trekning-match__slot--result,
    .matchmate-matchdetails .matchmate-trekning-match__result-block {
        display: none !important;
    }

    /* Server-navn: grønn på papir (overstyrer mørk-modus-skjermfarger; exact = behold farge ved print) */
    .matchmate-matchdetails .matchmate-draw-serve,
    .matchmate-matchdetails span.matchmate-draw-serve,
    [data-theme="dark"] .matchmate .matchmate-matchdetails .matchmate-draw-serve,
    .theme-dark .matchmate .matchmate-matchdetails .matchmate-draw-serve,
    .oqtane-dark .matchmate .matchmate-matchdetails .matchmate-draw-serve {
        color: #15803d !important;
        font-weight: 600 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

.matchmate-matchdetails-trekning-viewtoggle {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.125rem;
}

.matchmate-matchdetails-trekning-viewtoggle > .matchmate-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.matchmate-matchdetails-trekning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.matchmate-matchdetails-trekning-toggle__icon {
    flex-shrink: 0;
}

.matchmate-trekning-grid-wrap {
    margin: 0.75rem 0 1rem 0;
}

.matchmate-trekning-grid__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--matchmate-text, #111827);
}

.matchmate-trekning-grid__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.5rem 0;
}

.matchmate-trekning-grid__toolbar .matchmate-trekning-grid__title {
    margin: 0;
}

.matchmate-trekning-grid__toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.matchmate-roster-dialog .e-dlg-content {
    max-height: min(70vh, 32rem);
    overflow-y: auto;
}

.matchmate-trekning-grid-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.25rem;
    overscroll-behavior-x: contain;
    outline: none;
}

.matchmate-trekning-grid-scroll:focus-visible {
    box-shadow: 0 0 0 2px var(--matchmate-focus-ring, #2563eb);
    border-radius: 0.25rem;
}

.matchmate-trekning-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.35;
}

.matchmate-trekning-grid th,
.matchmate-trekning-grid td {
    border: 1px solid var(--matchmate-border, #e5e7eb);
    padding: 0.35rem 0.5rem;
    vertical-align: top;
}

.matchmate-trekning-grid thead th {
    background: var(--matchmate-surface-subtle, #f9fafb);
    font-weight: 600;
    text-align: center;
}

.matchmate-trekning-grid__corner {
    min-width: 4.5rem;
    background: var(--matchmate-surface-subtle, #f9fafb);
}

.matchmate-trekning-grid tbody th {
    background: var(--matchmate-surface-subtle, #f9fafb);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.matchmate-trekning-grid tbody td {
    min-width: 9rem;
    max-width: 18rem;
}

.matchmate-trekning-grid__empty {
    color: var(--matchmate-text-muted, #9ca3af);
}

/* Rutenett (MatchDetailsGridView) – små skjermer */
@media (max-width: 639.98px) {
    .matchmate-trekning-grid-scroll {
        margin-inline: 0;
        padding-inline-end: max(0.35rem, env(safe-area-inset-right, 0px));
        padding-inline-start: max(0.2rem, env(safe-area-inset-left, 0px));
        padding-bottom: 0.35rem;
    }

    .matchmate-trekning-grid {
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    .matchmate-trekning-grid th,
    .matchmate-trekning-grid td {
        padding: 0.5rem 0.45rem;
    }

    /* Første kolonne (tom hjørne + rundenavn) følger med ved horisontal scrolling */
    .matchmate-trekning-grid thead th:first-child,
    .matchmate-trekning-grid tbody th {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--matchmate-surface-subtle, #f9fafb);
        background-clip: padding-box;
        box-shadow: 3px 0 8px -2px rgba(0, 0, 0, 0.12);
    }

    .matchmate-trekning-grid thead th:first-child {
        z-index: 3;
    }

    [data-theme="dark"] .matchmate .matchmate-trekning-grid thead th:first-child,
    [data-theme="dark"] .matchmate .matchmate-trekning-grid tbody th,
    .theme-dark .matchmate .matchmate-trekning-grid thead th:first-child,
    .theme-dark .matchmate .matchmate-trekning-grid tbody th,
    .oqtane-dark .matchmate .matchmate-trekning-grid thead th:first-child,
    .oqtane-dark .matchmate .matchmate-trekning-grid tbody th {
        background: var(--matchmate-surface-subtle, #1e293b);
        box-shadow: 3px 0 8px -2px rgba(0, 0, 0, 0.45);
    }

    .matchmate-trekning-grid tbody td {
        min-width: 10.5rem;
        max-width: none;
    }

    .matchmate-trekning-grid__corner {
        min-width: 3.25rem;
    }

    .matchmate-trekning-match--gridcell .matchmate-trekning-match__lineup-body {
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
    }
}

@media print {
    .matchmate-trekning-grid thead th:first-child,
    .matchmate-trekning-grid tbody th {
        position: static !important;
        box-shadow: none !important;
    }
}

.matchmate-trekning-match--gridcell {
    margin: 0;
    padding: 0;
    border: none;
    display: block;
    width: 100%;
    min-width: 0;
}

.matchmate-detail-slots {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

/* Synkfusion-dialog / flex: unngå <hr> som kollapser eller får border nullstilt */
.matchmate-roster-dialog .matchmate-detail-slots__team-divider,
.matchmate-detail-slots__team-divider {
    display: block;
    box-sizing: border-box;
    align-self: stretch;
    flex-shrink: 0;
    width: 100%;
    height: 1px;
    min-height: 1px;
    margin: 0.65rem 0 0.35rem;
    padding: 0;
    border: 0;
    background-color: var(--matchmate-border, #94a3b8);
}

.matchmate-detail-slot-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.matchmate-detail-slot-row__label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--matchmate-text, #111827);
}

.matchmate-detail-slot-row__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.matchmate-detail-slot-row__fields .form-control {
    min-width: 0;
}

.matchmate-detail-slot-row__fields select.form-control {
    flex: 1 1 12rem;
    max-width: 100%;
}

.matchmate-detail-slot-row__fields input.form-control {
    flex: 1 1 10rem;
    max-width: 100%;
}

.matchmate-trekning-match__result-block {
    margin-top: 0.1rem;
}

.matchmate-trekning-results--gridcell {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.8rem;
}

.matchmate-trekning-msg {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--matchmate-text);
}

.matchmate-trekning-msg--warn {
    color: #b45309;
}

[data-theme="dark"] .matchmate .matchmate-trekning-msg--warn,
.theme-dark .matchmate .matchmate-trekning-msg--warn {
    color: #fbbf24;
}

.matchmate-matchcard-booked {
    font-size: 0.8rem;
    color: #0d9488 !important;
}

.matchmate-matchcard-booked-label {
    margin-right: 0.25rem;
}

.matchmate-matchcard--clickable {
    cursor: pointer;
}

    .matchmate-matchcard--clickable:hover {
        box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
    }

.matchmate-matchcard-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.matchmate-matchcard-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.matchmate-matchcard-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.25;
    word-break: break-word;
}

.matchmate-matchcard-badge--player {
    background: rgba(13, 148, 136, 0.15);
    color: #0f766e;
    border: 1px solid rgba(13, 148, 136, 0.35);
}

.matchmate-matchcard-badge--player-other {
    background: rgba(100, 116, 139, 0.14);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.35);
}

.matchmate-matchcard-badge--reserve {
    background: rgba(100, 116, 139, 0.12);
    color: var(--matchmate-text-muted);
    border: 1px solid var(--matchmate-border, #cbd5e1);
}

button.matchmate-matchcard-badge--signup {
    flex-shrink: 0;
    min-width: 1.65rem;
    justify-content: center;
    padding: 0.2rem 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button.matchmate-matchcard-badge--signup:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

button.matchmate-matchcard-badge--signup-plus {
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.45);
}

button.matchmate-matchcard-badge--signup-plus:hover:not(:disabled),
button.matchmate-matchcard-badge--signup-plus:focus-visible:not(:disabled) {
    background: rgba(34, 197, 94, 0.28);
}

button.matchmate-matchcard-badge--signup-minus {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

button.matchmate-matchcard-badge--signup-minus:hover:not(:disabled),
button.matchmate-matchcard-badge--signup-minus:focus-visible:not(:disabled) {
    background: rgba(239, 68, 68, 0.22);
}

[data-theme="dark"] .matchmate .matchmate-matchcard-badge--player,
.theme-dark .matchmate .matchmate-matchcard-badge--player,
.oqtane-dark .matchmate .matchmate-matchcard-badge--player {
    background: rgba(45, 212, 191, 0.12);
    color: #5eead4;
    border-color: rgba(45, 212, 191, 0.35);
}

[data-theme="dark"] .matchmate .matchmate-matchcard-badge--player-other,
.theme-dark .matchmate .matchmate-matchcard-badge--player-other,
.oqtane-dark .matchmate .matchmate-matchcard-badge--player-other {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.35);
}

.matchmate-card-slot {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
    color: var(--matchmate-text);
    word-break: break-word;
}

@media (min-width: 480px) {
    .matchmate-card-slot {
        font-size: 0.9rem;
    }
}

/* Create form – én kolonne, felter under hverandre, knapper under feltene venstrestilt */
.matchmate-form {
    max-width: 100%;
    padding: 1rem 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
}

@media (min-width: 576px) {
    .matchmate-form {
        max-width: 32rem;
    }
}

.matchmate-form-group {
    margin-bottom: 1rem;
    width: 100%;
}

    .matchmate-form-group label {
        display: block;
        font-weight: 500;
        margin-bottom: 0.35rem;
        color: var(--matchmate-text);
    }

.matchmate-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 480px) {
    .matchmate-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.matchmate-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.matchmate-form-actions.matchmate-form-actions--start {
    justify-content: flex-start;
}

/* Lagre til venstre, Avbryt til høyre (MatchCreateEdit, TournamentCreate) */
.matchmate-form-actions.matchmate-form-actions--save-cancel {
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.matchmate-form-actions.matchmate-form-actions--save-cancel .matchmate-btn {
    flex: 0 1 auto;
    min-width: 0;
}

.matchmate-form-actions-left,
.matchmate-form-actions-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.matchmate-form-actions-right {
    margin-left: auto;
}

.matchmate-form .form-control {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--matchmate-border, #d1d5db);
    border-radius: 0.375rem;
    font-size: 16px; /* avoids zoom on iOS */
    box-sizing: border-box;
    background: var(--matchmate-input-bg, #fff);
    color: var(--matchmate-text);
}

    .matchmate-form .form-control::placeholder {
        color: var(--matchmate-text-subtle);
    }

.matchmate-select {
    background-color: var(--matchmate-input-bg, #fff) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2' fill='none'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1rem !important;
    padding-right: 2.5rem !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}


.matchmate-msg {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.matchmate-msg--success {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #a3cfbb;
}

.matchmate-msg--error {
    background: #f8d7da !important;
    color: #842029 !important;
    border: 1px solid #f1aeb5;
}

.matchmate-msg--warning {
    background: #fff3cd !important;
    color: #664d03 !important;
    border: 1px solid #ffecb5;
}

/* Sendte invitasjoner */
.matchmate-invitations-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.matchmate-invitation-item {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--matchmate-card-bg, #f8fafc);
    border: 1px solid var(--matchmate-border, #e2e8f0);
    border-radius: 0.375rem;
}

.matchmate-invitation-item-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.matchmate-invitation-item-main .matchmate-invitation-email {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.matchmate-invitation-item-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.matchmate-invitation-email {
    font-weight: 500;
    color: var(--matchmate-text);
}

.matchmate-invitation-date {
    font-size: 0.8rem;
    color: var(--matchmate-text-subtle);
}

.matchmate-badge--pending {
    background: #e0f2fe;
    color: #0369a1 !important;
    text-shadow: none;
}

.matchmate-badge--accepted {
    background: #d1e7dd;
    color: #0f5132 !important;
    text-shadow: none;
}

.matchmate-badge--expired {
    background: #f8d7da;
    color: #842029 !important;
    text-shadow: none;
}

.matchmate-badge--owner {
    background: #e0e7ff;
    color: #3730a3 !important;
    text-shadow: none;
}

.matchmate-badge--admin {
    background: #fef3c7;
    color: #92400e !important;
    text-shadow: none;
}

.matchmate-invitation-item-actions .matchmate-switch--compact {
    flex-shrink: 0;
    margin-left: 0;
}
