/* Auth Screen */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 12px;
}

.auth-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: #777;
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.auth-tab-bar {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.auth-form {
    text-align: left;
}

.auth-error {
    background: #fff0f0;
    border: 1px solid #ffc0c0;
    border-radius: 6px;
    color: #c0392b;
    padding: 10px 14px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.auth-info {
    background: #f0f7ff;
    border: 1px solid #b7d7ff;
    border-radius: 6px;
    color: #23527c;
    padding: 10px 14px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.auth-link-button {
    display: block;
    width: 100%;
    margin-top: 12px;
    border: none;
    background: transparent;
    color: #5568d3;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
}

.auth-link-button:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #8a8a8a;
    font-size: 0.85rem;
    margin: 22px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e4e4e4;
}

.google-signin-container {
    display: flex;
    justify-content: center;
}

.google-auth-button {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    color: #3c4043;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.google-auth-button:hover {
    background: #f8fafd;
}

.google-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-weight: 700;
    color: #4285f4;
}

/* Header user area */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-choir-switcher {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
    text-align: left;
}

.header-choir-switcher label {
    font-size: 0.78rem;
    opacity: 0.9;
    color: #f4f6ff;
}

.header-choir-switcher select {
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.header-choir-switcher select option {
    color: #1f2937;
}

.user-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

/* Choir cards */
.choirs-section {
    padding: 0;
}

.choirs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.choir-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #eee;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.choir-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.choir-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.choir-logo {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
}

.choir-logo-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.choir-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.choir-meta {
    font-size: 0.82rem;
    color: #888;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.choir-type-badge {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #666;
}

.choir-role-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

.choir-role-badge.is-admin {
    background: #e8f5e9;
    color: #1b5e20;
}

.choir-role-badge.is-member {
    background: #f5f5f5;
    color: #616161;
}

.choir-description {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.choir-permission-note {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.members-admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.members-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: -4px 0 16px;
    padding: 10px 0 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.members-toolbar strong,
.members-toolbar span {
    display: block;
}

.members-toolbar span {
    margin-top: 2px;
    color: #6b7280;
    font-size: 0.84rem;
}

.members-list-scroll {
    min-height: 180px;
    max-height: calc(100vh - 260px);
    max-height: calc(100dvh - 260px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.member-admin-row {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.member-admin-main {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.member-admin-main span {
    font-size: 0.85rem;
    color: #6b7280;
}

.member-admin-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.member-search-results {
    gap: 6px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.member-search-results > strong {
    font-size: 0.84rem;
    color: #4b5563;
}

.member-search-option {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}

.member-search-option:hover {
    border-color: #667eea;
    background: #f4f6ff;
}

.member-search-option span,
.member-search-option small {
    display: block;
}

.member-search-option small {
    color: #6b7280;
    margin-top: 2px;
}

.member-existing-selection {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #eef4ff;
    color: #35528a;
    font-size: 0.84rem;
}

.member-existing-selection span {
    display: block;
    color: #5b6b82;
    margin-top: 2px;
}

.member-existing-selection button {
    border: 0;
    background: transparent;
    color: #4c51bf;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
    font-weight: 700;
}

.member-admin-controls input,
.member-admin-controls select {
    min-width: 130px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.modal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.member-account-badge {
    display: inline-flex;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.member-account-badge.linked {
    background: #dff7e7;
    color: #1f7a3f;
}

.member-account-badge.pending {
    background: #fff3cd;
    color: #8a5a00;
}

.member-invite-note {
    display: block;
    max-width: 280px;
    margin-top: 4px;
    color: #6b7280;
    font-size: 0.78rem;
    line-height: 1.35;
}

.voice-gender-hint {
    display: block;
    min-height: 18px;
    margin-top: 6px;
    color: #5b6b82;
    font-size: 0.82rem;
}

.voice-gender-badge {
    display: inline-flex;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.voice-gender-badge.male {
    background: #e5f0ff;
    color: #2458a6;
}

.voice-gender-badge.female {
    background: #ffe8f0;
    color: #a3265a;
}

.member-active-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #374151;
}

.choir-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.choir-voice-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.voice-part-tag {
    background: #f0f4ff;
    color: #667eea;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}

/* Fields */
.field-group {
    margin-bottom: 16px;
}

.field-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: white;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-full { width: 100%; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-card {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

#members-modal .modal-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

#song-modal .modal-card,
#version-modal .modal-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

#song-modal .modal-header,
#version-modal .modal-header {
    flex-shrink: 0;
}

#song-modal .modal-body,
#version-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#song-modal .modal-footer,
#version-modal .modal-footer {
    position: sticky;
    bottom: -24px;
    margin: 12px -24px -24px;
    padding: 14px 24px;
    border-top: 1px solid #eee;
    background: #fff;
}

#members-modal .modal-header,
#members-modal .modal-footer {
    flex-shrink: 0;
}

#members-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#add-member-modal {
    z-index: 1100;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.modal-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 4px;
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.modal-footer-sticky {
    flex-shrink: 0;
    margin-top: 0;
    padding: 14px 24px;
    border-top: 1px solid #eee;
    background: #fff;
}

/* Songs */
.songs-section {
    padding: 0;
}

.events-section {
    margin-top: 1.5rem;
}

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-bar select {
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

.songs-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.field-group-stack {
    align-items: flex-start;
    flex-direction: column;
}

.song-tag-filter {
    margin-bottom: 18px;
}

.song-tag-filter-title {
    margin-bottom: 8px;
    color: #4b5563;
    font-size: 0.86rem;
    font-weight: 700;
}

.song-tag-chip-list,
.song-tag-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-picker {
    border: 1px solid #d9e2f2;
    border-radius: 8px;
    background: #fff;
}

.tag-picker summary {
    min-height: 42px;
    padding: 10px 12px;
    color: #2d3748;
    cursor: pointer;
    font-weight: 700;
}

.tag-picker .song-tag-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px 12px;
    border-top: 1px solid #edf2f7;
}

.song-tag-chip {
    --tag-color: #667eea;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--tag-color) 35%, #d1d5db);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
}

.song-tag-chip:has(input:checked) {
    background: color-mix(in srgb, var(--tag-color) 14%, #fff);
    border-color: var(--tag-color);
    color: var(--tag-color);
}

.song-tag-chip input {
    accent-color: var(--tag-color);
}

#playlists-list {
    grid-template-columns: 1fr;
}

.playlist-scope-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.playlist-scope-bar small {
    color: #6b7280;
}

.song-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.song-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.song-list-table {
    display: grid;
    gap: 6px;
    width: 100%;
}

.song-list-row {
    display: grid;
    grid-template-columns: minmax(200px, 1.25fr) minmax(80px, auto) minmax(170px, 0.9fr) minmax(150px, 1fr) minmax(86px, auto) minmax(52px, auto);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #27364a;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.song-list-row:hover {
    border-color: #667eea;
    background: #f8faff;
    box-shadow: 0 4px 14px rgba(31, 41, 55, 0.08);
}

.song-list-title {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: #1f2937;
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-list-title strong,
.song-list-title small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-list-title strong {
    font-weight: 800;
}

.song-list-title small {
    color: #667085;
    font-size: 0.78rem;
    font-weight: 600;
}

.song-list-composer,
.song-list-code,
.song-list-tags,
.song-list-meta,
.song-list-language {
    min-width: 0;
    color: #667085;
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-list-code {
    display: inline-flex;
    width: fit-content;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef4ff;
    color: #3658a8;
    font-weight: 700;
    white-space: nowrap;
}

.song-code-muted {
    color: #94a3b8;
    font-weight: 600;
}

.song-list-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.song-list-no-tags {
    color: #9ca3af;
}

.song-list-meta,
.song-list-language {
    text-align: right;
}

.song-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.song-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.song-category-badge {
    background: #f0f4ff;
    color: #667eea;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.song-composer,
.song-arranger {
    font-size: 0.85rem;
    color: #666;
    margin: 4px 0;
}

.song-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.song-stats {
    display: flex;
    gap: 14px;
    font-size: 0.82rem;
    color: #777;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.song-version-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.version-card {
    border: 1px solid #e4e9f2;
    border-radius: 10px;
    padding: 18px;
    background: #fff;
}

.version-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.version-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.version-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.version-code-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #3658a8;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.version-visibility-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.visibility-private {
    background: #f1f5f9;
    color: #475569;
}

.visibility-public {
    background: #e0f2fe;
    color: #0369a1;
}

.visibility-sale {
    background: #fef3c7;
    color: #92400e;
}

.version-meta {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 8px;
}

.version-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.asset-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e7ebf3;
    border-radius: 8px;
    background: #fff;
}

.asset-main {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.asset-main audio {
    width: 100%;
}

.asset-item a {
    color: #5568d3;
    text-decoration: none;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.study-panel {
    margin: 16px 0;
    padding: 18px;
    border: 1px solid #dbe4f0;
    border-left: 4px solid #667eea;
    border-radius: 10px;
    background: #fff;
}

.study-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.study-header h4 {
    margin: 0;
    border: 0;
    padding: 0;
}

.study-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 12px;
}

.study-sheet-frame {
    height: 420px;
    border: 1px solid #d8dee9;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.study-sheet-actions {
    margin-bottom: 8px;
}

.study-sheet-frame img {
    width: 100%;
    min-height: 100%;
    display: block;
    object-fit: contain;
    object-position: top center;
}

.study-audios {
    display: grid;
    align-content: start;
    gap: 10px;
}

.study-audio-item {
    display: grid;
    gap: 6px;
    padding: 9px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.study-audio-item > span {
    font-weight: 600;
}

.study-audio-item audio {
    width: 100%;
}

.audio-loop-panel {
    display: grid;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    background: #f8f9fb;
}

.audio-loop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.audio-loop-fields,
.audio-loop-marker-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 6px;
    align-items: end;
}

.audio-loop-fields label {
    display: grid;
    gap: 3px;
    color: #667085;
    font-size: 0.74rem;
    font-weight: 600;
}

.audio-loop-fields input,
.audio-loop-marker-row select {
    width: 100%;
    min-height: 32px;
    border: 1px solid #d8dee9;
    border-radius: 7px;
    background: #fff;
    padding: 5px 7px;
    color: #1f2937;
    font-size: 0.82rem;
}

.btn-mini {
    padding: 6px 8px;
    font-size: 0.78rem;
    border-radius: 7px;
}

.btn-mini.active {
    background: #667eea;
    color: #fff;
}

.audio-loop-status {
    font-size: 0.78rem;
    color: #667085;
}

.study-links {
    display: grid;
    gap: 6px;
}

.playlist-form-card,
.playlist-item-form {
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fbfbfd;
    padding: 14px;
    width: 100%;
}

.playlist-choir-context {
    margin-bottom: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #eef4ff;
    color: #35528a;
    font-size: 0.9rem;
}

.playlist-choir-context > span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    margin-right: 8px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.78rem;
    font-weight: 800;
}

.playlist-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.playlist-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #d9e2f2;
    border-radius: 8px;
    background: #fff;
    color: #2d3748;
}

.playlist-public-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 12px;
}

.playlist-form-actions,
.playlist-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.playlist-items {
    margin-top: 12px;
}

.playlist-event-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px 12px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #eef0f5;
    border-radius: 8px;
    background: #fafbff;
    font-size: 0.88rem;
    color: #555;
}

.playlist-event-notes {
    grid-column: 1 / -1;
    color: #666;
}

.playlist-event-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    width: 100%;
    overflow-x: visible;
}

.playlist-sheet {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    color: #222;
    font-size: 0.92rem;
    table-layout: fixed;
}

.playlist-sheet th,
.playlist-sheet td {
    border: 1px solid #202020;
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
}

.playlist-sheet th {
    width: 160px;
    font-weight: 700;
    background: #f5f6f8;
}

.playlist-sheet .playlist-sheet-head th {
    background: #f5f6f8;
}

.playlist-item-remove {
    display: block;
    margin-top: 8px;
}

.playlist-liturgy {
    text-align: center;
    font-weight: 700;
}

.playlist-empty-row {
    text-align: center;
    color: #888;
    font-style: italic;
}

.playlist-participants {
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: #fbfcff;
}

.playlist-participants-header,
.playlist-participant,
.playlist-presence-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.playlist-participants-header,
.playlist-participant {
    justify-content: space-between;
}

.playlist-participants-header h4 {
    margin: 0;
}

.playlist-participant-group {
    margin-top: 12px;
}

.playlist-participant-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.playlist-participant {
    padding: 10px;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    background: #fff;
}

.playlist-participant small {
    display: block;
    color: #718096;
    margin-top: 2px;
}

.playlist-muted {
    color: #8a96aa;
}

.presence-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #edf2f7;
    color: #4a5568;
}

.presence-confirmed {
    background: #dff7e7;
    color: #1f7a3f;
}

.presence-declined {
    background: #ffe3e3;
    color: #b42318;
}

.presence-tentative {
    background: #fff3cd;
    color: #8a5a00;
}

@media (max-width: 700px) {
    .playlist-event-card {
        overflow-x: auto;
    }

    .playlist-sheet {
        min-width: 620px;
        table-layout: auto;
    }

    .playlist-participant,
    .playlist-presence-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .study-grid {
        grid-template-columns: 1fr;
    }

    .study-sheet-frame {
        height: 320px;
    }
}

/* Rehearsals */
.rehearsals-section {
    padding: 0;
}

.filter-bar {
    margin-bottom: 20px;
}

.filter-bar select {
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

.rehearsals-list {
    display: grid;
    gap: 16px;
}

.rehearsal-card {
    background: white;
    border: 1px solid #eee;
    border-left: 4px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.rehearsal-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateX(2px);
}

.rehearsal-card.completed {
    border-left-color: #27ae60;
    opacity: 0.85;
}

.rehearsal-card.cancelled {
    border-left-color: #e74c3c;
    opacity: 0.7;
}

.rehearsal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.rehearsal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
}

.rehearsal-date {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.rehearsal-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.rehearsal-status-badge.scheduled {
    background: #e3f2fd;
    color: #1976d2;
}

.rehearsal-status-badge.completed {
    background: #e8f5e9;
    color: #388e3c;
}

.rehearsal-status-badge.cancelled {
    background: #ffebee;
    color: #c62828;
}

.rehearsal-location,
.rehearsal-objectives {
    font-size: 0.88rem;
    color: #666;
    margin: 8px 0;
}

.rehearsal-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #777;
    margin: 12px 0;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.rehearsal-songs-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.song-tag {
    background: #f0f4ff;
    color: #667eea;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.more-tag {
    background: #f5f5f5;
    color: #999;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Rehearsal Detail Modal */
.modal-large {
    max-width: 800px;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: #888;
    margin: 4px 0 0 0;
}

/* Song detail modal: fixed header + internal scrolling body */
#song-detail-modal .modal-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

#song-detail-modal .modal-header {
    flex-shrink: 0;
    background: #fff;
    z-index: 1;
}

#song-detail-modal #song-detail-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.detail-songs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-song-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.mass-plan-song {
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fbfbfd;
    padding: 12px;
}

.mass-plan-song-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.mass-plan-song-main .song-info {
    min-width: 0;
}

.song-version-text {
    display: inline-block;
    margin-left: 6px;
    color: #777;
    font-size: 0.86rem;
}

.song-note {
    margin-top: 4px;
    color: #666;
    font-size: 0.86rem;
}

.mass-plan-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.mass-plan-form,
.soloist-form {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fff;
}

.solo-planning-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eeeeee;
}

.solo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.solo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.82rem;
    font-weight: 600;
}

.solo-chip small {
    color: #4d7f52;
    font-weight: 500;
}

.environment-badge {
    align-items: center;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.solo-chip button {
    border: none;
    background: transparent;
    color: #2e7d32;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.empty-inline {
    color: #999;
    font-size: 0.86rem;
}

.song-order {
    font-weight: 600;
    color: #667eea;
    min-width: 24px;
}

.song-info {
    flex: 1;
    font-size: 0.9rem;
}

.duration {
    font-size: 0.8rem;
    color: #999;
    margin-left: 8px;
}

.empty-msg {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Attendance */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    gap: 16px;
}

.member-info {
    flex: 1;
}

.member-info strong {
    font-size: 0.95rem;
    color: #333;
}

.voice-part-label {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.attendance-controls {
    display: flex;
    gap: 6px;
}

.attendance-btn {
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.attendance-btn:hover {
    background: #f5f5f5;
}

.attendance-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
    .auth-card { padding: 28px 20px; }
    .choirs-grid { grid-template-columns: 1fr; }
    .songs-list { grid-template-columns: 1fr; }
    .song-list-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        min-height: 0;
    }
    .song-list-title,
    .song-list-code,
    .song-list-composer,
    .song-list-tags {
        grid-column: 1 / -1;
        white-space: normal;
    }
    .song-list-meta,
    .song-list-language {
        text-align: left;
    }
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }
    .header-brand {
        width: 100%;
        text-align: center;
    }
    .header-brand .subtitle {
        overflow-wrap: anywhere;
    }
    .header-user {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
        min-width: 0;
        gap: 10px;
        align-items: center;
    }
    .header-choir-switcher {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }
    .header-choir-switcher select {
        width: 100%;
        min-height: 44px;
        padding: 9px 12px;
    }
    .environment-badge {
        grid-column: 1 / -1;
        justify-self: start;
        max-width: 100%;
        white-space: normal;
        text-align: left;
    }
    .user-badge {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .header-user > .btn {
        min-height: 44px;
        justify-self: end;
    }
    .section-header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 18px;
    }
    .section-header h2 {
        margin: 0;
        font-size: 1.55rem;
        line-height: 1.25;
    }
    .section-header .btn {
        width: 100%;
        min-height: 46px;
    }
    .events-section {
        margin-top: 0;
    }
    .search-bar { flex-direction: column; }
    .field-row { grid-template-columns: 1fr; }
    .playlist-scope-bar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }
    .playlist-choice {
        width: 100%;
    }
    .mass-plan-song-main,
    .solo-planning-row { align-items: stretch; flex-direction: column; }
    .attendance-row { flex-direction: column; align-items: stretch; }
    .attendance-controls { flex-wrap: wrap; }
    .asset-item { flex-direction: column; align-items: stretch; }
    .asset-item .btn { align-self: flex-start; }
    .members-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .members-toolbar .btn {
        width: 100%;
    }
    .members-list-scroll {
        max-height: calc(100vh - 300px);
        max-height: calc(100dvh - 300px);
    }
    .modal-form-actions {
        flex-direction: column-reverse;
    }
    .modal-form-actions .btn {
        width: 100%;
    }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }

    #song-detail-modal {
        padding: 12px;
    }

    #song-detail-modal .modal-card {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }
}
