/* Unified admin shell — class-specific selectors only */
.admin-primary-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 20px 0;
    background: #faf6f1;
    border-bottom: 2px solid #e8dcc0;
}
.admin-primary-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #6b4423;
    border-radius: 8px 8px 0 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.admin-primary-tab:hover {
    background: #f5f1e8;
}
.admin-primary-tab.active {
    background: #fff;
    border-bottom-color: #8B4513;
    color: #8B4513;
}
.admin-context-bar {
    padding: 16px 30px;
    background: #fff;
    border-bottom: 1px solid #e8dcc0;
}
.admin-context-bar.hidden {
    display: none !important;
}
.admin-context-bar .context-label {
    color: #8B4513;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1rem;
}
.admin-panel {
    display: none;
    padding: 30px;
}
.admin-panel.active {
    display: block;
}
.admin-panel-placeholder {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px dashed #ddd;
}
.admin-panel-placeholder .panel-title {
    color: #8B4513;
    font-size: 1.4rem;
    margin-bottom: 12px;
}
.admin-header-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.admin-teambuilding-held {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8dcc0;
}
.admin-teambuilding-held summary {
    cursor: pointer;
    color: #8B4513;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

/* Kursus overblik */
.overblik-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 20px;
    align-items: center;
}
.overblik-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 0.95rem;
    cursor: pointer;
}
.overblik-course-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    /* Metric min-widths — pairs align vertically across rows inside the flex band */
    --ov-col-seats: 11.5rem;
    --ov-col-awaiting: 8rem;
    --ov-col-booked: 8.75rem;
    --ov-col-rooms: 11.5rem;
}
.overblik-course-row {
    background: #fff;
    border: 1px solid #e8dcc0;
    border-radius: 8px;
    border-left: 4px solid #8B4513;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}
.overblik-course-row.overblik-course-highlight {
    box-shadow: 0 0 0 2px #8B4513;
}
/* Course header: chevron | title | metrics (flex band, grows) | [→ Administration when present] */
.overblik-course-header {
    display: grid;
    grid-template-columns:
        1.25rem
        minmax(12rem, min(26rem, 32vw))
        1fr;
    align-items: center;
    gap: 8px 20px;
    padding: 10px 16px;
    min-height: 40px;
    line-height: 1.35;
    cursor: pointer;
    background: #faf6f1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
}
.overblik-course-header:has(.overblik-course-actions:not(:empty)) {
    grid-template-columns:
        1.25rem
        minmax(12rem, min(26rem, 32vw))
        1fr
        auto;
}
.overblik-course-header:hover {
    background: #f5f1e8;
}
.overblik-course-header > .overblik-course-chevron {
    min-width: 1.25rem;
    color: #8B4513;
    font-size: 0.9rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}
.overblik-course-title {
    color: #8B4513;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: start;
    text-align: left;
    min-width: 0;
}
.overblik-metrics-band {
    grid-column: 3;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0 2rem;
    min-width: 0;
}
.overblik-metric-pair {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    text-align: left;
    flex: 0 0 auto;
}
.overblik-metric-pair .ov-label,
.overblik-metric-pair .ov-num {
    white-space: nowrap;
}
.overblik-metrics-band .overblik-metric-pair:nth-child(1) {
    min-width: var(--ov-col-seats);
}
.overblik-metrics-band .overblik-metric-pair:nth-child(2) {
    min-width: var(--ov-col-awaiting);
}
.overblik-metrics-band .overblik-metric-pair:nth-child(3) {
    min-width: var(--ov-col-booked);
}
.overblik-metrics-band .overblik-metric-pair:nth-child(4),
.overblik-metric-pair.overblik-metric-empty {
    min-width: var(--ov-col-rooms);
}
.overblik-metric-pair.overblik-metric-empty {
    visibility: hidden;
    min-height: 1px;
}
.overblik-course-actions {
    grid-column: 4;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    justify-self: end;
    flex-shrink: 0;
    padding-left: 12px;
}
.overblik-course-actions:empty {
    display: none;
}
.overblik-col {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}
.overblik-col.overblik-status,
.overblik-col.overblik-metric {
    min-width: max-content;
}
.overblik-status {
    color: #777;
    font-weight: 400;
}
.overblik-metric {
    color: #777;
}
.ov-label {
    color: #777;
    font-weight: 400;
}
.ov-num {
    color: #333;
    font-weight: 700;
}

/*
 * Kursus overblik tab only (#overblikCourseList).
 * Flexbox with wrap: chevron | title | metrics band | → Administration. Flex items
 * can never overlap — when a row runs out of width, the metric pairs and the
 * Administration button wrap to the next line instead of stacking on top of each
 * other. This is why Toscana (4 metric pairs + button) stays readable at every width.
 * Deltager administration keeps the shared grid/flex rules above — do NOT move these
 * selectors to the global .overblik-* space.
 */
#overblikCourseList .overblik-course-header,
#overblikCourseList .overblik-with-rooms .overblik-course-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
}
#overblikCourseList .overblik-course-chevron {
    flex: 0 0 auto;
}
#overblikCourseList .overblik-course-title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
#overblikCourseList .overblik-metrics-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px 20px;
    flex: 1 1 auto;
    min-width: 0;
}
#overblikCourseList .overblik-metric-pair {
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
}
/* With flex-wrap no spacer is needed to keep columns aligned. */
#overblikCourseList .overblik-metric-pair.overblik-metric-empty {
    display: none;
}
#overblikCourseList .overblik-course-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

@media (max-width: 640px) {
    /* Kursus overblik stays flex-wrap (above); only ease spacing/typography here. */
    #overblikCourseList .overblik-course-header {
        gap: 4px 14px;
        font-size: 0.82rem;
        padding: 8px 12px;
    }
    #overblikCourseList .overblik-course-actions {
        margin-left: 0;
    }
    .overblik-course-list {
        --ov-col-seats: 10rem;
        --ov-col-awaiting: 7rem;
        --ov-col-booked: 8rem;
        --ov-col-rooms: 10rem;
    }
    .overblik-course-header,
    .overblik-course-header:has(.overblik-course-actions:not(:empty)) {
        grid-template-columns: 1.1rem 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px 10px;
        font-size: 0.82rem;
        padding: 8px 12px;
    }
    .overblik-course-header > .overblik-course-chevron {
        grid-row: 1 / span 3;
        align-self: start;
        padding-top: 2px;
    }
    .overblik-course-header:not(:has(.overblik-course-actions:not(:empty))) > .overblik-course-chevron {
        grid-row: 1 / span 2;
    }
    .overblik-course-title {
        grid-column: 2;
        white-space: normal;
    }
    .overblik-metrics-band {
        grid-column: 2;
        flex-wrap: wrap;
        gap: 4px 16px;
    }
    .overblik-course-actions {
        grid-column: 2;
        justify-content: flex-start;
        padding-left: 0;
        margin-top: 2px;
    }
    .deltager-kursist-row .overblik-course-header.deltager-kursist-header {
        display: grid;
        grid-template-columns: 1.1rem 1fr;
        grid-template-rows: auto auto;
    }
    .deltager-kursist-row .overblik-course-header.deltager-kursist-header .deltager-kursist-identity {
        grid-column: 2;
        grid-row: 1;
    }
    .deltager-kursist-row .overblik-course-header.deltager-kursist-header .deltager-kursist-stats {
        grid-column: 2;
        grid-row: 2;
    }
    .deltager-kursist-row .overblik-participants {
        overflow-x: auto;
    }
    .deltager-kursist-table {
        min-width: 520px;
    }
    .overblik-col {
        flex: 0 0 auto;
        overflow: visible;
        text-overflow: clip;
    }
}
.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
}
.overblik-participants {
    padding: 8px 12px 12px;
    border-top: 1px solid #e8dcc0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}
.overblik-participants.hidden {
    display: none;
}

/* Per kursist — collapsible participant rows (mirrors overblik course chrome) */
.deltager-kursist-row .overblik-course-header.deltager-kursist-header {
    display: grid;
    grid-template-columns: 1.1rem 1fr;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    align-items: start;
}
.deltager-kursist-row .overblik-course-header.deltager-kursist-header .overblik-course-chevron {
    grid-row: 1 / span 2;
    align-self: center;
}
.deltager-kursist-identity {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    min-width: 0;
    color: #555;
}
.deltager-kursist-identity .participant-name {
    color: #8B4513;
    font-weight: 700;
    font-size: 0.9rem;
}
.deltager-kursist-identity a {
    color: #8B4513;
}
.deltager-kursist-stats {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 28px;
    padding-top: 2px;
    border-top: 1px solid #ede6da;
    margin-top: 2px;
    padding-bottom: 2px;
}
.deltager-kursist-stat {
    display: flex;
    flex-direction: column;
    min-width: 6.5rem;
}
.deltager-kursist-stat-label {
    font-size: 0.75rem;
    color: #777;
    font-weight: 400;
    line-height: 1.3;
    white-space: normal;
}
.deltager-kursist-stat-value {
    font-size: 1rem;
    color: #333;
    font-weight: 700;
    line-height: 1.2;
}
.deltager-kursist-table {
    margin-top: 0;
}
.deltager-kursist-table td {
    vertical-align: middle;
    white-space: nowrap;
}
.deltager-kursist-table .deltager-kursist-type {
    font-weight: 700;
    color: #8B4513;
}
.deltager-kursist-table .deltager-kursist-status {
    font-weight: 600;
    color: #555;
}
.deltager-kursist-table .deltager-kursist-actions-td {
    text-align: right;
    width: 1%;
}
.deltager-kursist-table .deltager-kursist-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    white-space: nowrap;
}
.deltager-kursist-table .deltager-kursist-actions .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Teambuilding tab — distinct row headers (not overblik course grid) */
#teambuildingSection .teambuilding-inquiry-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    --tb-col-status: 11.5rem;
    --tb-col-metric: 7.5rem;
}
#teambuildingSection .teambuilding-section-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--admin-muted, #5c5c5c);
}
#teambuildingSection .teambuilding-section-title:first-child {
    margin-top: 0;
}
#teambuildingSection .teambuilding-row {
    background: #fff;
    border: 1px solid #e8dcc0;
    border-radius: 8px;
    border-left: 4px solid #8B4513;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}
#teambuildingSection .teambuilding-row-header {
    display: grid;
    grid-template-columns:
        1.1rem
        minmax(0, 1fr)
        var(--tb-col-status)
        var(--tb-col-metric)
        auto;
    align-items: center;
    gap: 8px 16px;
    padding: 8px 12px;
    min-height: 36px;
    line-height: 1.3;
    cursor: pointer;
    background: #faf6f1;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
}
#teambuildingSection .teambuilding-row-header:hover {
    background: #f5f1e8;
}
#teambuildingSection .teambuilding-row-chevron {
    min-width: 1.1rem;
    color: #8B4513;
    font-size: 0.9rem;
    width: 1.1rem;
    text-align: center;
}
#teambuildingSection .teambuilding-row-title {
    color: #8B4513;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    justify-self: start;
    text-align: left;
}
#teambuildingSection .teambuilding-row-status {
    color: #777;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: start;
    min-width: 0;
}
#teambuildingSection .teambuilding-row-metric {
    font-size: 0.9rem;
    white-space: nowrap;
    justify-self: start;
    text-align: left;
}
#teambuildingSection .teambuilding-row-metric .tb-label {
    color: #777;
    font-weight: 400;
}
#teambuildingSection .teambuilding-row-metric .tb-num {
    color: #333;
    font-weight: 700;
}
#teambuildingSection .teambuilding-row-actions {
    display: flex;
    gap: 8px;
    justify-self: end;
}

@media (max-width: 640px) {
    #teambuildingSection .teambuilding-inquiry-list {
        --tb-col-status: 9rem;
        --tb-col-metric: 6.5rem;
    }
    #teambuildingSection .teambuilding-row-header {
        gap: 6px 10px;
        font-size: 0.82rem;
    }
}

/* Teambuilding inquiry workflow panels */
.teambuilding-workflow-panel {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}
.teambuilding-panel-title {
    margin: 0 0 0.65rem;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}
.teambuilding-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem 1rem;
    margin: 0;
}
.teambuilding-meta-grid dt {
    font-size: 0.75rem;
    color: #666;
    margin: 0;
}
.teambuilding-meta-grid dd {
    margin: 0.15rem 0 0;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.teambuilding-meta-wide {
    grid-column: 1 / -1;
}
.teambuilding-dialog-note,
.teambuilding-admin-note {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    color: #555;
}
.teambuilding-dialog-placeholder {
    padding: 0.65rem 0.75rem;
    border: 1px dashed #bbb;
    border-radius: 4px;
    background: #fff;
    color: #888;
    font-size: 0.85rem;
}
.teambuilding-hook-label {
    font-style: italic;
}
.teambuilding-admin-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}
.teambuilding-admin-fields label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #444;
}
.teambuilding-admin-fields input {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
}
.teambuilding-admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.teambuilding-price-hint {
    font-size: 0.85rem;
    color: #856404;
}
.deltager-terminal-note {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.btn.btn-disabled,
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.35);
}
.btn.btn-disabled.btn-success,
.btn-success:disabled {
    background: #6c757d;
    border-color: #6c757d;
}

.overblik-participant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 12px;
}
.overblik-participant-table th {
    text-align: left;
    padding: 8px 10px;
    color: #8B4513;
    border-bottom: 2px solid #e8dcc0;
    font-weight: 600;
}
.overblik-participant-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0ebe3;
    vertical-align: middle;
}
.overblik-status-cell,
.participant-status-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.period-item.period-highlight {
    box-shadow: 0 0 0 2px #8B4513;
}

/* Payment road lights */
.wf-road-lights {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}
.wf-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    border: 1px solid #bbb;
    flex-shrink: 0;
}
.wf-light-on {
    background: #8B4513;
    border-color: #6b3410;
}
.wf-light-current {
    box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.35);
}
.wf-light-connector {
    width: 14px;
    height: 2px;
    background: #ddd;
    flex-shrink: 0;
}
