:root {
    /* Bright, warm light palette — sunrise + fresh sport */
    --bg: #C6CAED;             /* warm cream */
    --bg-2: #fff1e1;           /* gentle peach for gradient */
    --panel: #ffffff;          /* clean white panels */
    --panel-2: #ececec;        /* warm light peach for nested cards */
    --panel-3: #d8d8d8;        /* a touch deeper for emphasis */
    --text: #2d3142;           /* warm charcoal */
    --muted: #6e7390;          /* soft warm gray */
    --accent: #4A5240;
    --accent-hover: #929891;   /* lighter coral */
    --accent-contrast: #ffffff;
    --accent-2: #9c9c9c;       /* fresh mint — secondary */
    --accent-2-contrast: #074c48;
    --accent-3: #ffc857;       /* sunshine yellow — highlight */
    --danger: #a12731;         /* warm red */
    --danger-contrast: #ffffff;
    --border: #e1e1e1;         /* warm sand border */
    --border-strong: #e5d3b8;  /* slightly stronger border */
    --warning: #ffb627;        /* sunshine warning */
    --chip-text: #2d3142;
    --chip-bg: #ffe2d6;        /* peach chip */
    --chip-bg-hover: #ffcdba;  /* deeper peach */
    --shadow-soft: 0 6px 20px rgba(45, 49, 66, 0.06);
    --shadow-card: 0 10px 28px rgba(255, 122, 92, 0.10);
    --shadow-pop: 0 18px 40px rgba(45, 49, 66, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: #e9e9e9;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.prefill-panel {
    margin-top: 24px;
}

.container {
    width: 100%;
    min-height: 100vh;
    padding: 0 24px 24px;
}

.courts {
    display: flex;
    gap: 10px;
}

.court-count {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.court-count input[type="number"] {
    width: 4rem;
    flex-shrink: 0;
}

button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.app-header {
    display: grid;
    grid-template-columns: 1fr auto;   /* title takes remaining, controls take what they need */
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.app-header, .grid {
    max-width: 800px;
    margin: 0 auto 20px;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    -webkit-background-clip: text;
    background-clip: text;
}

.header-menu {
    position: relative;
}

.menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(45, 49, 66, 0.28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: backdropIn 0.15s ease;
}

@keyframes backdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.menu-backdrop.open {
    display: block;
}

.menu-toggle {
    min-width: 52px;
    font-size: 22px;
    line-height: 1;
    padding: 10px 18px;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    display: none;
    z-index: 100;
    transform-origin: top right;
    animation: menuOpen 0.15s ease;
}

@keyframes menuOpen {
    from { opacity: 0; transform: scale(0.95) translateY(-6px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.menu-dropdown.open {
    display: block;
}

.menu-dropdown button.menu-item {
    width: 100%;
    text-align: left;
    margin: 0;
    background: transparent;
    color: var(--text);
    border-radius: 10px;
    padding: 11px 14px;
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.12s ease;
}

.menu-dropdown button.menu-item:hover {
    background: var(--panel-2);
    opacity: 1;
}

/* Danger item gets a separator on top and a subtle red tint on hover */
.menu-dropdown button.menu-item.danger {
    color: var(--danger);
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    border-radius: 0 0 10px 10px;
}

.mini-table td.center,
.mini-table th.center {
    text-align: center;
}

.h-no-m {
    margin: 0;
}

h1, h2, h3 {
    margin: 0 0 16px;
}

.mb {
    margin-bottom: 16px;
}

.mt {
    margin-top: 16px;
}

.subtle {
    color: var(--muted);
    line-height: 1.5;
}

.small-text {
    font-size: 13px;
}



.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
}

.panel + .panel {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 640px) {
    .toast {
        top: 12px;
        right: 12px;
        left: 12px;
        min-width: 0;
        max-width: none;
    }
}

label {
    display: block;
    font-weight: bold;
    margin: 10px 0;
}

.settings-panel label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
}

.settings-panel input[type="checkbox"] {
    width: auto;
    transform: scale(1.2);
    margin-top: 5px;
}

input[type="checkbox"] {
    accent-color: var(--accent);
}

input,
button,
select {
    font: inherit;
    height: 46px;
}

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

input[type="number"],
input[type="text"],
select,
textarea {
    width: 100%;
    background: var(--panel);
    color: var(--text);
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}


.settings-row {
    margin-top: 16px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions input[type="text"] {
    flex: 1 1 220px;
}

.actions.no-top-margin {
    margin-top: 0;
}

button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border: none;
    border-radius: 12px;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    opacity: 1;
}

button:active {
    transform: translateY(1px);
}

.primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.primary:hover {
    background: var(--accent-hover);
}

.secondary {
    background: #ffffff;
    color: var(--accent-2-contrast);
}

.secondary:hover {
    background: #cfcfcf;
}

.danger {
    background: #891720;
    color: var(--danger-contrast);
}

.danger:hover {
    background: #9f1721;
}

.ghost {
    background: #ffffff;
    color: var(--text);
    border: 1px solid #e4e4e4;
}

.ghost:hover {
    background: #eeeeee;
}

.result-card {
    border-radius: 16px;
    padding: 16px;
    background: #00000000;
    margin-bottom: 14px;
    border-bottom: 1px solid #00000012;
    border-radius: 0;
}

select {
    text-align: center;
    text-align-last: center;
}

select option {
    text-align: left;
}

.court-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: bold;
}


.vs-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.team {
    background: var(--panel);
    border: 1px solid #ffffff;
    border-radius: 14px;
    padding: 14px;
}

.team h4 {
    margin: 0 0 8px 0;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-line {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 6px 0;
}


.tag {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(78, 205, 196, 0.18);
    color: var(--accent-2-contrast);
    font-weight: 600;
}

.bench-list, .history-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.6;
}

.warning {
    color: #8a5a06;
    background: rgba(255, 182, 39, 0.18);
    border: 1px solid rgba(255, 182, 39, 0.45);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 12px;
}

.player-manager-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-direction: row;
    align-items: center;
    margin-top: 24px;
}

.lowered {
    font-size: 10px;
    padding: 0;
    margin: 7px 0 0 -6px;
}

.player-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-direction: row !important;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-contrast);
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 500;
    padding: 7px 12px;
    transition: background 0.15s ease, transform 0.05s ease;
}

.player-chip:hover {
    background: var(--accent-hover);
    cursor: pointer;
}

.player-chip:active {
    transform: translateY(1px);
}


.level {
    font-size: 12px;
}

.player-chip button {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mini-table th,
.mini-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 6px;
    text-align: left;
    vertical-align: top;
}

.mini-table th {
    color: var(--muted);
    font-weight: bold;
}

.table-subtle {
    color: var(--accent);
    font-size: 12px;
    display: inline;
}

.mt24 {
    margin-top: 24px;
}

#newPlayerLevel {
    width: 60px;
}
#newPlayerName {
    width: 100%;
}

.w100 {
    width: 100%;
}

.settings-panel,
.new-player-panel,
.import-export-panel,
.bulk-delete-panel,
.login-panel,
.users-panel,
.change-password-panel,
.admin-panel {
    display: none;
}

.settings-panel.open,
.new-player-panel.open,
.import-export-panel.open,
.bulk-delete-panel.open,
.login-panel.open,
.users-panel.open,
.change-password-panel.open,
.admin-panel.open {
    display: block;
}

textarea {
    resize: vertical;
}

.muted {
    color: var(--muted);
}

.flex-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.history-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.history-header h2 {
    margin-bottom: 0;
}

.player-manager-list {
    display: grid;
    gap: 12px;
}

.player-row-name-pref {
    display: flex;
    gap: 16px;
}

.player-row.is-inactive {
    opacity: 0.82;
}

.player-row-main {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    height: 40px;
}

.player-row button {
    font-weight: normal;
}


.icon-toggle-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.player-row-main button {
    width: auto;
}

.player-row-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.player-level-badge {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(78, 205, 196, 0.16);
    color: var(--accent-2-contrast);
    font-weight: 600;
}

.player-row-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
    flex-direction: row-reverse;
}


.player-row-settings {
    display: grid;
    gap: 12px;
    width: 100%;
}

.prefill-header {
    width: 100%;
    padding: 0;
}

.prefill-header h3 {
    font-size: 16px;
}

.collapse-indicator {
    margin-left: auto; /* ekstra sikkerhed */
}

.prefill-area {
    display: grid;
}

.prefill-card {
    border: none;
    border-radius: 0;
    padding: 20px 20px;
    padding-bottom: 20px;
    display: flex;
    gap: 14px;
    background: none;
    flex-direction: column;
    margin: 0 -18px;
    border-bottom: 1px solid #00000012;
}

prefill-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-direction: row;
    align-items: center;
}

.prefill-format {
    min-width: 140px;
}

.flex-center {
    display: flex;
    align-items: center;
}


.prefill-grid {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-direction: row;
}

.prefill-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prefill-side {
    display: flex;
    gap: 10px;
    border-radius: 12px;
    width: 100%;
    justify-content: space-between;
    flex-direction: column;
}

.prefill-side label {
    margin: 0;
}

.prefill-side label span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--muted);
}

.prefill-vs {
    font-weight: 700;
    color: var(--accent);
}

.compact-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.player-row-inline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.level-select {
    width: 72px;
    min-width: 72px;
}

.player-row-inline-controls select:not(.level-select) {
    width: 150px;
    min-width: 150px;
}

.player-row-name {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-start;
}


.collapsible-toggle {
    width: 100%;
    display: flex;
    height: 50px;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: left;
    background: transparent;
    color: var(--text);
    padding: 0;
    border: none;
    cursor: pointer;
}


.collapsible-toggle:hover {
    opacity: 1;
}

.collapsible-content {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.collapsed .collapsible-content {
    display: none;
}

.collapse-indicator {
    font-size: 30px;
    line-height: 1;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.collapsible-panel:not(.collapsed) .collapse-indicator {
    transform: rotate(180deg);
}

.panel-toggle {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.player-row button.player-row-name {
    font-weight: 500;
}

.player-row button.player-row-name:hover {
    background: var(--panel-3);
    color: var(--muted);
    font-weight: 500;
}

.player-row.is-active button.player-row-name {
    background-color: var(--accent);
    color: var(--accent-contrast);
    border-color: transparent;
    font-weight: 600;
}

.player-row.is-active button.player-row-name:hover {
    background-color: var(--accent-hover);
}

.prefill-actions {
    display: flex;
}

/* Label for settings sections that aren't checkboxes */
.settings-label {
    margin-bottom: 10px;
    opacity: 0.85;
}

/* Inline grid of format-size checkboxes */
.format-sizes-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 30px;
}

.format-size-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    margin: 0;
}

.settings-sub-row {
    margin-left: 24px;
}

.settings-sub-row--hidden {
    display: none;
}

/* Dims the level-balance settings when skill levels are turned off */
.settings-group-disabled {
    opacity: 0.38;
    pointer-events: none;
    user-select: none;
}

/* Reveal-level button in the player manager list */
.level-reveal-btn {
    font-size: 13px;
    padding: 3px 10px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s;
}

.level-reveal-btn:hover {
    background: var(--panel-3);
}

/* The level select area that appears after reveal */
.level-reveal-area {
    display: none;
}

.level-reveal-area--open {
    display: block;
}

@media (max-width: 980px) {
    .grid,
    .vs-grid,
    .player-row-main {
        flex-direction: column;
        align-items: stretch;
    }



    /* Bottom sheet on mobile */
    .menu-dropdown {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 20px;
        top: auto;
        min-width: 0;
        border-radius: 20px;
        padding: 10px;
        transform-origin: bottom center;
        animation: menuOpenMobile 0.18s ease;
    }

    @keyframes menuOpenMobile {
        from { opacity: 0; transform: scale(0.97) translateY(12px); }
        to   { opacity: 1; transform: scale(1)   translateY(0); }
    }

    .menu-dropdown button.menu-item {
        padding: 15px 18px;
        font-size: 16px;
        border-radius: 12px;
    }

    .menu-dropdown button.menu-item.danger {
        border-radius: 0 0 12px 12px;
    }

    .panel {
        border: none;
        border-radius: 0;
    }

    .container {
        padding: 0;
    }

    .app-header {
        border: none;
        border-radius: 0;
    }

    /* --- ændret del --- */
    .player-row-main.compact-player-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .player-row-name {
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-row-inline-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        width: auto;
    }

    .level-select {
        width: 52px !important;
        min-width: 52px !important;
        padding-left: 8px;
        padding-right: 8px;
    }

    .player-row-inline-controls select:not(.level-select) {
        width: 96px !important;
        min-width: 96px !important;
    }


    .app-header, .grid {
        max-width: 100%;
    }
    .app-header {
        margin: 0 auto 20px;
    }

}


.retry-row {
    padding-top: 18px;
}


@keyframes spin {
    to { transform: rotate(360deg); }
}

.generate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 250, 243, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.generate-overlay--visible {
    display: flex;
}

.generate-overlay__spinner {
    width: 52px;
    height: 52px;
    border: 5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.generate-overlay__text {
    color: var(--text);
    font-size: 16px;
    opacity: 0.85;
    letter-spacing: 0.02em;
}

/* ----- Edit-mode for the current round ----- */

.result-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-actions .ghost.is-active {
    background: var(--accent);
    color: var(--accent-contrast);
}

.result-slot-select {
    width: 100%;
}

.benched-line {
    margin-top: 14px;
    color: var(--muted);
    line-height: 1.5;
}

.benched-edit-area {
    padding: 12px;
    margin-top: 14px;
}

.benched-edit-area > strong {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.benched-edit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ----- Team mode: teams panel ----- */

.team-mode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.teams-area {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.team-card {
    padding: 12px;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.team-card-total {
    font-size: 12px;
    color: var(--muted);
}

.team-card-members {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-card-member {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    font-size: 14px;
}

/* ----- Team super-player display in result ----- */

.result-team-block {
    border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
    padding: 6px 0;
}

.result-team-block:last-child {
    border-bottom: none;
}

.result-team-name {
    margin-bottom: 6px;
}

.result-team-members {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    padding-left: 4px;
}

.team-member-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
    padding: 2px 0;
}

.team-member-line .level {
    color: var(--text);
}

/* Reserves space in edit mode so swapping teams of different sizes doesn't
   jump the layout — the placeholder occupies the same row height as a real
   member line but stays invisible. */
.team-member-line--placeholder {
    visibility: hidden;
    pointer-events: none;
}

/* ----- Session transfer (export/import) ----- */

.session-transfer-section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-top: 40px;
}

.session-transfer-section h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.session-transfer-section textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    word-break: break-all;
}

/* ----- Setup Wizard ----- */

@media (max-width: 640px) {
}

@media (max-width: 640px) {





}


/* ============================================================
   Settings v3: mode toggle + rule dropdowns + player view controls
   ============================================================ */

/* Visually hide an input while keeping it accessible. Used for the
   real <input id="teamMode"> behind the segmented buttons. */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Segmented "Skiftende makkere / Faste hold" toggle at the top of settings. */
.settings-row--mode-toggle {
    margin-bottom: 18px;
}
.mode-toggle {
    display: inline-flex;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px;
    background: var(--panel-2, #f7f8f5);
    gap: 0;
}
.mode-toggle__option {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;     /* center the label horizontally */
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    text-align: center;
}
.mode-toggle__option:hover:not(.mode-toggle__option--active) {
    background: rgba(0, 0, 0, 0.04);
}
.mode-toggle__option--active {
    background: var(--accent, #4A5240);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* "Regler" section. */
.settings-section {
    border-top: 1px solid var(--border);
    margin-top: 18px;
    padding-top: 14px;
}
.settings-section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text);
    letter-spacing: 0.01em;
}

/* Each rule row: label on the left, select on the right. */
.settings-rule-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.settings-rule-row > label {
    flex: 1 1 200px;
    font-weight: 500;
}
.rule-select {
    flex: 1 1 230px;
    box-sizing: border-box;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    line-height: 1.2;
    padding: 0 30px 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel, #ffffff);
    color: var(--text);
    font-size: 15px;
    text-align: left;
    text-align-last: left;
    cursor: pointer;
}
.rule-select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
/* Same treatment for the sort dropdown in the Spillere header. */
.sort-select {
    box-sizing: border-box;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    line-height: 1.2;
    text-align: left;
    text-align-last: left;
}
.rule-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}
.rule-toggle-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}
.rule-hint {
    flex: 1 1 100%;
    font-size: 13px;
    color: var(--muted, #666);
    background: var(--panel-2, #f7f8f5);
    padding: 6px 10px;
    border-radius: 8px;
    margin-top: 2px;
}

/* "Spillere" header actions row: sort select + global eye + add player. */
.player-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sort-select {
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel, #ffffff);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}
.sort-select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Generic small square icon-only button. */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

/* Global "show all levels" toggle (eye). aria-pressed=true means levels
   are visible; aria-pressed=false (i.e. --off class) means hidden. */
/* Eye inside the player chip (when a player's level is hidden). */
/* Mobile layout: stack rule rows so the dropdown sits below the label. */
@media (max-width: 640px) {
    .settings-rule-row {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-rule-row > label {
        flex: 0 0 auto;
    }
    .rule-select, .sort-select {
        width: 100%;
    }
    .player-actions {
        gap: 6px;
    }
}


/* Bigger menu for the gear menu, to fit the sort sub-items + delete. */
.actions-dropdown {
    min-width: 270px;
}

/* Section header inside a menu dropdown ("Sortér spillere"). */
.menu-section {
    margin: 6px 0;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.menu-section-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted, #777);
    padding: 6px 14px 4px;
}

/* Radio-style menu items with a marker on the left. */
.menu-radio .menu-radio-marker {
    display: inline-block;
    width: 18px;
    text-align: center;
    color: transparent;
    font-size: 12px;
    flex: 0 0 18px;
}
.menu-radio--active .menu-radio-marker {
    color: var(--accent, #4A5240);
}
.menu-radio--active {
    background: rgba(0, 0, 0, 0.04);
}

/* Eye icon with optional "slash" overlay so users can see at a glance
   whether the menu item will hide or show levels. */
.eye-icon {
    display: inline-block;
    position: relative;
    line-height: 1;
    font-size: 17px;
}
.eye-icon--off {
    opacity: 0.55;
}
.eye-icon--off::after {
    content: '';
    position: absolute;
    left: -3px;
    right: -3px;
    top: 50%;
    height: 2px;
    background: currentColor;
    transform: rotate(-22deg) translateY(-50%);
    transform-origin: left center;
    border-radius: 1px;
    pointer-events: none;
}

/* Bulk-delete panel. */
.bulk-delete-panel .bulk-delete-intro {
    margin: 8px 0 16px;
}
.bulk-delete-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.bulk-delete-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    max-height: 60vh;
    overflow-y: auto;
}
.bulk-delete-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border, #e1e1e1);
    border-radius: 10px;
    cursor: pointer;
    background: var(--panel);
    transition: background 0.12s ease, border-color 0.12s ease;
}
.bulk-delete-row:hover {
    background: var(--panel-2, #f7f8f5);
    border-color: var(--accent, #4A5240);
}
.bulk-delete-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #b91c1c;
    flex: 0 0 18px;
    cursor: pointer;
}
.bulk-delete-name {
    flex: 1 1 auto;
    font-weight: 600;
}
.bulk-delete-level {
    color: var(--muted, #777);
    font-size: 13px;
}
.bulk-delete-actions {
    display: flex;
    justify-content: flex-end;
}
.bulk-delete-actions .danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Make the bulk-delete-panel also display:none by default like the
   other standalones (it's added in HTML alongside them). */


/* Bulletproof header layout: the title and the controls block are two
   independent grid columns (title fills remaining space, controls take only
   what they need). Inside .header-controls, grid-auto-flow:column gives each
   header-menu its own column so they can never overlap. */
.header-controls {
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 51;          /* above the sticky header's drop-shadow */
}
.header-controls > .header-menu {
    display: block;
    position: relative;
    /* Guarantee no transforms / absolute pinning can put this on top of its
       sibling — these are grid items, the parent controls their position. */
    inset: auto !important;
}
.header-controls .menu-toggle {
    min-width: 44px;
    padding: 8px 12px;
    font-size: 20px;
}
.app-title {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hint text under a settings checkbox. */
/* Checkbox label that has a small inline italic hint underneath the main text. */
.checkbox-with-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.checkbox-with-hint__text 

/* ===========================================================
   Login / users / cloud-lists styles
   =========================================================== */

.login-panel .muted,
.users-panel .muted {
    margin-bottom: 16px;
}

.login-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.login-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(185, 28, 28, 0.08);
    border: 1px solid rgba(185, 28, 28, 0.35);
    border-radius: 10px;
    color: #b91c1c;
    font-size: 14px;
}

.lists-section-title {
    margin: 20px 0 10px;
    font-size: 14px;
    color: var(--muted, #777);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lists-section-title:first-child {
    margin-top: 0;
}
.cloud-lists-section {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.user-create-form {
    background: var(--panel-2, #f7f8f5);
    border-radius: 12px;
    padding: 14px 16px 4px;
    margin-bottom: 18px;
}
.user-create-form h3 {
    margin: 0 0 10px;
    font-size: 16px;
}
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border, #e1e1e1);
    border-radius: 10px;
    background: var(--panel);
    flex-wrap: wrap;
}
.user-row-main {
    flex: 1 1 200px;
    min-width: 0;
}
.user-row-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-row-email {
    color: var(--muted, #777);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-role-select {
    width: auto;
    min-width: 90px;
    height: 36px;
    padding: 0 10px;
    box-sizing: border-box;
    text-align: left;
    text-align-last: left;
}
.user-row-pw,
.user-row-delete {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-row-delete:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .user-row {
        flex-direction: column;
        align-items: stretch;
    }
    .user-row-pw,
    .user-row-delete {
        align-self: flex-end;
    }
}


/* ===========================================================
   Admin-panel
   =========================================================== */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.admin-stat-card {
    background: var(--panel-2, #f7f8f5);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
}
.admin-stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}
.admin-stat-label {
    font-size: 12px;
    color: var(--muted, #777);
    margin-top: 4px;
}

.admin-clubs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row-usage {
    font-size: 12px;
    color: var(--muted, #777);
}

.admin-activity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--panel);
}
.admin-activity-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid var(--panel-2, #f0f0f0);
    font-size: 14px;
}
.admin-activity-row:last-child {
    border-bottom: none;
}
.admin-activity-time {
    flex: 0 0 auto;
    color: var(--muted, #777);
    font-size: 12px;
    white-space: nowrap;
    min-width: 110px;
}
.admin-activity-text {
    flex: 1 1 auto;
    min-width: 0;
}
.admin-activity-text em {
    color: var(--muted, #555);
}
