body[data-module-theme="rehearsals"] {
    --rehearsals-accent: var(--module-page-accent, #6fb4b1);
    --rehearsals-on-accent: var(--module-page-on-accent, #ffffff);
    --rehearsals-accent-soft: color-mix(in srgb, var(--rehearsals-accent) 14%, var(--app-surface));
    --rehearsals-accent-strong: color-mix(in srgb, var(--rehearsals-accent) 74%, #1d5a43);
    --rehearsals-danger: #d95c4d;
    --rehearsals-danger-soft: color-mix(in srgb, var(--rehearsals-danger) 12%, var(--app-surface));
}

.rehearsals-shell {
    width: var(--app-content-width);
    max-width: var(--app-content-max);
    margin: 0 auto;
}

.rehearsals-hero {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 var(--app-section-gap);
    padding: 24px 300px 24px 26px;
    border-radius: var(--app-radius-lg);
    background: var(--rehearsals-accent) !important;
    box-shadow: var(--app-shadow-card);
    color: var(--rehearsals-on-accent) !important;
}

.rehearsals-kicker,
.rehearsals-title,
.rehearsals-intro {
    margin: 0;
    color: inherit !important;
}

.rehearsals-kicker {
    margin-bottom: 8px;
    color: color-mix(in srgb, var(--rehearsals-on-accent) 78%, transparent);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.rehearsals-title {
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1;
}

.rehearsals-intro {
    max-width: 760px;
    margin-top: 10px;
    color: color-mix(in srgb, var(--rehearsals-on-accent) 84%, transparent);
    font-size: 16px;
    line-height: 1.5;
}

.rehearsals-panel {
    padding: var(--app-card-padding);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-card);
}

.rehearsals-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--app-line);
}

.rehearsals-toolbar h2,
.rehearsals-toolbar p {
    margin: 0;
}

.rehearsals-toolbar p {
    margin-top: 6px;
    color: var(--app-muted);
    font-size: 14px;
    font-weight: 700;
}

.rehearsals-add-button,
.rehearsal-primary,
.rehearsal-secondary,
.rehearsal-danger,
.rehearsal-pill-button,
.rehearsal-small-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--rehearsals-accent) 44%, var(--app-line));
    border-radius: 999px;
    background: var(--rehearsals-accent-soft);
    color: var(--rehearsals-accent-strong);
    font-weight: 900;
    cursor: pointer;
}

.rehearsals-add-button {
    width: 54px;
    height: 54px;
    padding: 0;
    border-color: var(--rehearsals-accent) !important;
    background: var(--rehearsals-accent) !important;
    color: var(--rehearsals-on-accent) !important;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--rehearsals-accent) 26%, transparent);
}

.rehearsals-add-button svg,
.rehearsal-close-button svg,
.rehearsal-card-action svg,
.rehearsal-small-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.7;
}

.rehearsals-add-button svg {
    width: 30px;
    height: 30px;
}

.rehearsals-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.rehearsal-card {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--app-line);
    border-left: 6px solid var(--rehearsals-accent);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-strong);
    color: var(--app-text);
}

.rehearsal-card-date {
    display: grid;
    gap: 4px;
}

.rehearsal-card-date strong {
    font-size: 18px;
}

.rehearsal-card-date span,
.rehearsal-card-meta,
.rehearsal-card-participants {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 800;
}

.rehearsal-card-main h3 {
    margin: 0;
    font-size: 20px;
}

.rehearsal-card-main p {
    margin: 6px 0 0;
    color: var(--app-muted);
    line-height: 1.4;
}

.rehearsal-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.rehearsal-card-meta span,
.rehearsal-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--rehearsals-accent) 12%, transparent);
    color: color-mix(in srgb, var(--rehearsals-accent) 72%, var(--app-text));
    font-size: 12px;
    font-weight: 900;
}

.rehearsal-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rehearsal-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--rehearsals-accent) !important;
    border-radius: 999px;
    background: var(--rehearsals-accent-soft) !important;
    color: var(--rehearsals-accent-strong) !important;
    cursor: pointer;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--rehearsals-accent) 18%, transparent);
}

.rehearsal-card-action.primary {
    border-color: var(--rehearsals-accent) !important;
    background: var(--rehearsals-accent) !important;
    color: var(--rehearsals-on-accent) !important;
}

.rehearsal-card-action.danger {
    border-color: var(--rehearsals-danger) !important;
    background: var(--rehearsals-danger-soft) !important;
    color: var(--rehearsals-danger) !important;
    box-shadow: none;
}

.rehearsals-empty {
    padding: 28px;
    border: 1px dashed color-mix(in srgb, var(--rehearsals-accent) 40%, var(--app-line));
    border-radius: var(--app-radius-md);
    background: color-mix(in srgb, var(--rehearsals-accent) 6%, var(--app-surface));
    color: var(--app-muted);
    font-weight: 800;
    text-align: center;
}

.rehearsal-modal[hidden] {
    display: none;
}

.rehearsal-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 28px;
}

.rehearsal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 22, 0.58);
}

.rehearsal-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1180px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-xl);
    background: var(--app-bg);
    box-shadow: 0 34px 90px rgba(17, 35, 51, 0.28);
    overflow: hidden;
}

body[data-auth-required="true"] .rehearsal-dialog-head,
.rehearsal-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border: 0;
    border-radius: 0;
    background: var(--rehearsals-accent) !important;
    color: var(--rehearsals-on-accent) !important;
    box-shadow: none;
}

.rehearsal-dialog-head p,
.rehearsal-dialog-head h2 {
    margin: 0;
    color: inherit !important;
}

.rehearsal-dialog-head p {
    color: color-mix(in srgb, var(--rehearsals-on-accent) 78%, transparent);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.rehearsal-dialog-head h2 {
    margin-top: 4px;
    font-size: 28px;
}

.rehearsal-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 1px solid color-mix(in srgb, var(--rehearsals-on-accent) 42%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--rehearsals-on-accent) 16%, transparent);
    color: var(--rehearsals-on-accent);
    cursor: pointer;
}

.rehearsal-close-button svg {
    width: 28px;
    height: 28px;
}

.rehearsal-form {
    overflow: auto;
    padding: 22px;
    scrollbar-color: var(--rehearsals-accent) color-mix(in srgb, var(--rehearsals-accent) 16%, transparent);
}

.rehearsal-form::-webkit-scrollbar {
    width: 12px;
}

.rehearsal-form::-webkit-scrollbar-track {
    border-radius: 999px;
    background: color-mix(in srgb, var(--rehearsals-accent) 12%, transparent);
}

.rehearsal-form::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: var(--rehearsals-accent);
    background-clip: content-box;
}

.rehearsal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.rehearsal-block {
    padding: 18px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-card);
}

.rehearsal-block h3 {
    margin: 0 0 14px;
    font-size: 19px;
}

.rehearsal-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.rehearsal-field-grid .wide {
    grid-column: 1 / -1;
}

.rehearsal-field label,
.rehearsal-field span {
    display: block;
}

.rehearsal-field span {
    margin-bottom: 7px;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 900;
}

.rehearsal-field input,
.rehearsal-field select {
    width: 100%;
}

.rehearsal-participant-grid {
    display: grid;
    gap: 8px;
}

.rehearsal-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-strong);
    font-weight: 800;
}

.rehearsal-check-row small {
    color: var(--app-muted);
}

.rehearsal-guest-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 12px;
}

.rehearsal-guest-list,
.rehearsal-song-list,
.rehearsal-task-list {
    display: grid;
    gap: 10px;
}

.rehearsal-guest-list {
    margin-top: 12px;
}

.rehearsal-guest-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface-strong);
    font-weight: 800;
}

.rehearsal-response-box {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--app-line);
}

.rehearsal-response-toggle {
    align-items: center;
}

.rehearsal-response-toggle span {
    display: grid;
    gap: 3px;
}

.rehearsal-response-toggle small {
    display: block;
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 800;
}

.rehearsal-response-fields {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--rehearsals-accent) 24%, var(--app-line));
    border-radius: var(--app-radius-md);
    background: color-mix(in srgb, var(--rehearsals-accent) 7%, var(--app-surface));
}

.rehearsal-response-fields textarea {
    width: 100%;
    min-height: 84px;
    box-sizing: border-box;
}

.rehearsal-editor {
    overflow: hidden;
    border: 1px solid var(--app-line-strong);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-strong);
}

.rehearsal-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid var(--app-line);
    background: color-mix(in srgb, var(--rehearsals-accent) 13%, var(--app-surface));
}

.rehearsal-editor-toolbar button {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--rehearsals-accent) 24%, var(--app-line));
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 14px;
    font-weight: 900;
}

.rehearsal-editor-surface {
    min-height: 130px;
    max-height: 32vh;
    padding: 12px 14px;
    overflow: auto;
    outline: none;
    color: var(--app-text);
    line-height: 1.5;
}

.rehearsal-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: var(--app-muted);
}

.rehearsal-task-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) auto;
    gap: 8px;
    align-items: center;
}

.rehearsal-task-row input,
.rehearsal-task-row select {
    min-height: 42px;
}

.rehearsal-small-icon {
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-color: var(--rehearsals-accent) !important;
    background: var(--rehearsals-accent) !important;
    color: var(--rehearsals-on-accent) !important;
}

.rehearsal-small-icon[data-remove-task],
.rehearsal-small-icon[data-remove-song],
.rehearsal-small-icon[data-remove-guest] {
    border-color: var(--rehearsals-danger) !important;
    background: var(--rehearsals-danger-soft) !important;
    color: var(--rehearsals-danger) !important;
}

.rehearsal-song-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 12px;
}

.rehearsal-song-card {
    padding: 14px;
    border: 1px solid var(--app-line);
    border-left: 5px solid var(--rehearsals-accent);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-strong);
}

.rehearsal-song-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.rehearsal-song-head strong {
    display: block;
    font-size: 17px;
}

.rehearsal-song-head span {
    display: block;
    margin-top: 3px;
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 800;
}

.rehearsal-form-actions {
    position: sticky;
    bottom: -22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 18px -22px -22px;
    padding: 14px 22px;
    border-top: 1px solid var(--app-line);
    background: color-mix(in srgb, var(--app-bg) 94%, transparent);
    backdrop-filter: blur(10px);
}

.rehearsal-primary,
.rehearsal-secondary,
.rehearsal-danger,
.rehearsal-pill-button {
    min-height: 42px;
    padding: 0 18px;
}

.rehearsal-primary {
    border-color: var(--rehearsals-accent);
    background: var(--rehearsals-accent);
    color: var(--rehearsals-on-accent);
}

.rehearsal-danger {
    border-color: var(--app-danger, #d96b5f);
    background: color-mix(in srgb, var(--app-danger, #d96b5f) 12%, transparent);
    color: var(--app-danger, #d96b5f);
}

.rehearsal-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.rehearsal-section-title h3 {
    margin: 0;
}

.rehearsal-collapse-head {
    min-height: 32px;
}

.rehearsal-collapse-body {
    display: grid;
    gap: 12px;
}

.rehearsal-collapsible.is-collapsed > .rehearsal-collapse-body {
    display: none;
}

.rehearsal-collapse-toggle {
    position: relative;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin-left: auto;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--app-text) !important;
    box-shadow: none !important;
    cursor: pointer;
}

.rehearsal-collapse-toggle::before {
    position: absolute;
    top: 10px;
    left: 11px;
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    content: "";
    transform: rotate(225deg);
    transition: transform .18s ease;
}

.rehearsal-collapsible.is-collapsed > .rehearsal-collapse-head .rehearsal-collapse-toggle::before,
.rehearsal-song-card.is-collapsed > .rehearsal-song-head .rehearsal-collapse-toggle::before {
    transform: rotate(45deg);
}

.rehearsal-participant-section {
    display: grid;
    gap: 12px;
}

.rehearsal-song-head > div {
    min-width: 0;
    margin-right: auto;
}

.rehearsal-song-card > .rehearsal-collapse-body {
    grid-column: 1 / -1;
}

.rehearsal-song-card.is-collapsed .rehearsal-song-head {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .rehearsals-hero {
        padding-right: 24px;
    }

    .rehearsal-card,
    .rehearsal-grid,
    .rehearsal-field-grid,
    .rehearsal-task-row {
        grid-template-columns: 1fr;
    }

    .rehearsal-card-actions {
        justify-content: flex-start;
    }

    .rehearsal-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
}
