/* Practice session circle variants */
.circle-attended {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.circle-absent {
    background: #e9e9e9;
    color: #666;
    border: 2px solid #999;
}

.circle-upcoming {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

.circle {
    font-size: 0.8em;
    font-weight: 600;
}

/* Fee status colors */
.fee-paid {
    border-left: 4px solid #28a745;
    background: #f0fff4;
}

.fee-unpaid {
    border-left: 4px solid #E74C3C;
    background: #fff5f5;
}

.fee-pending {
    border-left: 4px solid #f0ad4e;
    background: #fffbf0;
}

.fee-back {
    border-left: 4px solid #0075eb;
    background: #e3e4fc;
}

/* Fee status text colors */
.fee-status-paid {
    color: #28a745;
    font-weight: bold;
}

.fee-status-unpaid {
    color: #E74C3C;
    font-weight: bold;
}

.fee-status-pending {
    color: #f0ad4e;
    font-weight: bold;
}

.fee-status-back {
    color: #0075eb;
    font-weight: bold;
}

/* Beautified sheet-music links */
.link-btn {
    display: block;
    background: linear-gradient(135deg, var(--primary) 0%, #ffffff 100%);
    color: #fff;
    padding: 9px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 700;
    margin: 15px 0;
    border: none;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: left;
}

.link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
    color: #fff;
    text-decoration: none;
}

/* Placeholder link – shown when no real URL is available */
.link-btn[href="#"] {
    background: #eee;
    color: #aaa;
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

/* Member name in attendance grid */
.member-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text);
    margin: 3px 0 0 0;
    text-align: center;
}

/* ── Home page layout ── */
.home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 24px 24px;
}

.home-card h4 {
    margin: 0 0 16px 0;
    font-size: 1.1em;
    color: var(--text);
    font-weight: 600;
}

#checkin-area {
    width: 100%;
    max-width: 320px;
    margin-top: 20px;
}

.btn-checkin-main {
    background: linear-gradient(135deg, #f97373, #e53e3e);
    font-size: 1.3em;
    font-weight: 700;
    padding: 16px 24px;
    border-radius: 14px;
    width: 100%;
    box-shadow: 0 4px 16px rgba(229, 62, 62, 0.45);
    letter-spacing: 0.05em;
}

.btn-checkin-main:active {
    transform: scale(0.97);
}

.refresh-btn-row {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.btn-icon-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid #fecaca;
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-icon-refresh:hover {
    background: #fecaca;
    color: #7f1d1d;
}

.wifi-card {
    margin-top: 20px;
    width: 100%;
    max-width: 320px;
    background: linear-gradient(145deg, #fff5f5, #ffffff);
    border-radius: 14px;
    padding: 14px 16px 12px;
    text-align: left;
    border: 1px solid rgba(248, 113, 113, 0.4);
    box-shadow: 0 6px 20px rgba(248, 113, 113, 0.25);
    box-sizing: border-box;
}

.wifi-label {
    font-size: 0.75em;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.wifi-info-row {
    font-size: 0.88em;
    color: #555;
    line-height: 1.6;
}

.wifi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.wifi-subtitle {
    font-size: 0.78em;
    color: #7c2d12;
    opacity: 0.8;
}

.wifi-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.wifi-field-label {
    font-size: 0.78em;
    color: #6b7280;
}

.wifi-field-value {
    font-size: 1.02em;
    font-weight: 600;
    color: #111827;
}

.wifi-pass {
    font-family: monospace;
    letter-spacing: 0.12em;
}

.wifi-copy-btn {
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f97373, #e53e3e);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(229, 62, 62, 0.45);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.wifi-copy-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(229, 62, 62, 0.45);
}

.location-card {
    font-size: 0.88em;
    color: #666;
    margin-top: 6px;
    margin-bottom: 4px;
    padding: 10px 16px;
    min-height: 0;
}

/* ── Payment page (繳費相關) ── */
.fee-page-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    padding: 20px 20px;
}

.fee-section {
    position: relative;
    padding: 24px 18px 16px;
    border-radius: 18px;
    background: #ffcda0;
    border: 1px solid rgba(249, 115, 22, 0.08);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
}

.fee-section-bg-label {
    position: absolute;
    top: 14px;
    left: 20px;
    font-size: 0.65em;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #f97316;
    text-transform: uppercase;
    opacity: 0.9;
}

.fee-section-bg-label::before {
    content: "QUARTERLY FEES";
}

.fee-section-activity-label::before {
    content: "SPECIAL EVENTS";
}

.fee-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.fee-cell {
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.fee-cell-label {
    font-size: 0.65em;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.fee-cell-value {
    font-size: 1.15em;
    font-weight: 700;
    color: #1e293b;
}

/* Specific status colors for values if needed, but keeping it clean for now */

.fee-total-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fffcf9 0%, #fff7ed 100%);
    border-radius: 16px;
    border: 1px solid #ffedd5;
}

.fee-total-label {
    font-size: 0.9em;
    font-weight: 700;
    color: #9a3412;
}

.fee-total-value {
    font-size: 1.5em;
    font-weight: 800;
    color: #ea580c;
    font-feature-settings: "tnum";
}

/* ── Payment Guide Card (Redesign) ── */
.payment-guide-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 4px;
    min-height: 240px;
    /* 拉長一點高度 */
    display: flex;
    flex-direction: column;
}

.guide-header {
    padding: 22px 20px 18px;
    background: #ffffff;
}

.guide-label {
    font-size: 0.65em;
    font-weight: 800;
    color: #f97316;
    letter-spacing: 0.22em;
    margin-bottom: 4px;
}

.guide-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #171717;
}

.bank-info-table {
    padding: 16px 20px;
    margin: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    /* 更明確的淺藍灰底色 */
    border-radius: 14px;
    border: 2px solid #cbd5e1;
    /* 增加粗度並加深一點點顏色 */
}

.bank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-label {
    font-size: 0.85em;
    color: #64748b;
    font-weight: 500;
}

.bank-value {
    font-size: 0.95em;
    font-weight: 600;
    color: #1e293b;
}

.highlight-account {
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-size: 1.15em;
    letter-spacing: 0.08em;
    color: #ea580c;
}

.guide-footer-actions {
    padding: 24px 20px;
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.btn-guide-action {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-guide-action.primary {
    background: #f97316;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.btn-guide-action.secondary {
    background: #fff;
    color: #f97316;
    border: 1.5px solid #ffedd5;
}

.btn-guide-action:active {
    transform: translateY(1px) scale(0.98);
}

@media (max-width: 400px) {
    .guide-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .btn-form-action {
        text-align: center;
    }
}

.fee-cell-future {
    opacity: 0.5;
    filter: grayscale(0.2);
}

.fee-cell-info {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    text-align: center;
}

/* ── Attendance page (到場名單) ── */
.attendance-card {
    padding: 16px;
}

.attendance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    flex-direction: column-reverse;
}

.attendance-stats {
    font-size: 0.88em;
    color: #555;
    font-weight: 600;
}

.stats-sep {
    margin: 0 6px;
    color: #ccc;
}

.attendance-toggle {
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    border: 1.5px solid #eab308;
    /* Yellow border */
    background: #fffbeb;
    /* Light yellow bg */
}

.toggle-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    font-size: 0.8em;
    color: #b7791f;
    /* Golden brown text */
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-weight: 500;
}

.toggle-btn.toggle-active {
    background: #facc15;
    /* Bright yellow */
    color: #451a03;
    /* Darker contrast */
    font-weight: 600;
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.member-card {
    padding: 10px 6px 8px;
    border-radius: 10px;
    text-align: center;
    background: #f7f9fc;
}

.member-card.member-signed {
    background: linear-gradient(135deg, #fefce8 0%, #fde047 50%, #facc15 100%);
    border: 1px solid #eab308;
}

.member-card.member-absent {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fcd34d 100%);
    border: 1px solid #f59e0b;
}

.member-card.member-leave {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 50%, #fed7aa 100%);
    border: 1px solid #fb923c;
}

.member-card.member-missing {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 50%, #fde047 100%);
    border: 1px solid #ca8a04;
}

/* Toggle filter */
#today-signin-grid[data-filter="signed"] .member-card:not([data-status="signed"]) {
    display: none;
}

#today-signin-grid[data-filter="not-signed"] .member-card:not([data-status="not-signed"]) {
    display: none;
}

#today-signin-grid[data-filter="leave"] .member-card:not([data-status="leave"]) {
    display: none;
}

#today-signin-grid[data-filter="absent"] .member-card:not([data-status="absent"]) {
    display: none;
}

/* ── Practice dates page (團練日期) ── */
.dates-page-card {
    padding: 28px 20px;
}

.dates-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.dates-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dates-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.page-section-title {
    font-size: 1em;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0 0;
}

.badge-blue {
    background: var(--primary);
    color: #fff;
    font-size: 0.75em;
    vertical-align: middle;
}

/* dates-rate-row 不再使用，保留類別避免舊樣式衝突 */
.dates-rate-row {
    display: none;
}

/* Print Checkbox Custom Styling (Purple) */
.print-checkbox {
    accent-color: rgb(119, 59, 255);
    /* Primary Purple */
    transform: scale(1.3);
    margin-right: 12px;
    cursor: pointer;
}

/* ── Practice counts page (練習次數) ── */
.counts-page-card {
    padding: 28px 20px;
    min-height: 200px;
}

/* ── Sheet music page (找尋樂譜) ── */
.music-page-card {
    padding: 28px 20px;
    min-height: 200px;
}

/* UI Toast Notification */
.ui-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary);
    /* 使用目前的色調作為背景 */
    color: white;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.9em;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    white-space: nowrap;
}

.ui-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ui-toast.hidden {
    display: none;
}

@media (max-width: 480px) {
    .member-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── 花蓮營詳細按鈕 ── */
.btn-hualien-detail {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    font-size: 0.62em;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-hualien-detail:active {
    transform: scale(0.94);
    box-shadow: 0 1px 4px rgba(249, 115, 22, 0.25);
}

/* ── 花蓮營費用明細彈窗 ── */
#hualien-modal.hm-visible {
    opacity: 1 !important;
}

.hm-sheet {
    background: #fff;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0 0 env(safe-area-inset-bottom, 16px);
    transform: translateY(40px);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
}

#hualien-modal.hm-visible .hm-sheet {
    transform: translateY(0);
}

.hm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 14px;
    border-bottom: 1px solid #ffedd5;
    background: linear-gradient(135deg, #fff7ed, #fff);
    border-radius: 24px 24px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.hm-eyebrow {
    font-size: 0.6em;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: #f97316;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.hm-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #1a1a1a;
}

.hm-close {
    background: #ffedd5;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #9a3412;
    cursor: pointer;
    flex-shrink: 0;
}

.hm-close:active {
    transform: scale(0.9);
}

.hm-table {
    width: 100%;
    border-collapse: collapse;
    padding: 8px 0;
}

.hm-table tr {
    border-bottom: 1px solid #fff7ed;
}

.hm-table tr:last-child {
    border-bottom: none;
}

.hm-label {
    padding: 11px 22px;
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 500;
    width: 55%;
}

.hm-val {
    padding: 11px 22px 11px 0;
    font-size: 0.9em;
    font-weight: 700;
    color: #1e293b;
    text-align: right;
}

.hm-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 18px 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-radius: 14px;
    border: 1.5px solid #fed7aa;
}

.hm-total-label {
    font-size: 0.88em;
    font-weight: 700;
    color: #9a3412;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hm-total-val {
    font-size: 1.4em;
    font-weight: 800;
    color: #ea580c;
    font-feature-settings: "tnum";
}

/* ── 本日編制：樂器人數統計（條列式表格） ── */
.instrument-summary-grid {
    width: 100%;
}

.instrument-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

.instrument-summary-table thead {
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-light));
}

.ist-th-name,
.ist-th-count {
    padding: 8px 12px;
    font-weight: 700;
    color: #475569;
    text-align: center;
    border-bottom: 2px solid var(--primary-border);
}

.ist-th-name {
    text-align: left;
    width: 50%;
}

.ist-row-total {
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-light));
    border-bottom: 2px solid var(--primary-border);
}

.ist-row {
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s;
}

.ist-row:hover {
    background: #f8fafc;
}

.ist-row:last-child {
    border-bottom: none;
}

.ist-name {
    padding: 9px 12px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.ist-signed {
    padding: 9px 12px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
}

.ist-total {
    padding: 9px 12px;
    text-align: center;
    font-weight: 700;
    color: #64748b;
}

/* ── 打擊編制 ── */
.percussion-song-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1.5px solid #fcd34d;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 700;
    color: #92400e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.percussion-song-btn:hover,
.percussion-song-btn.perc-expanded {
    background: linear-gradient(135deg, #fde68a, #fbbf24);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.perc-song-arrow {
    font-size: 1.1em;
    transition: transform 0.2s;
}

.percussion-detail {
    padding: 0 8px 10px;
}

.percussion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #fffbeb;
    border-radius: 8px;
    font-size: 0.85em;
    border-left: 3px solid #f59e0b;
}

.perc-part {
    font-weight: 700;
    color: #92400e;
    min-width: 70px;
}

.perc-instrument {
    color: #78350f;
    flex: 1;
    min-width: 60px;
}

.perc-change {
    color: #b45309;
    font-size: 0.9em;
    min-width: 50px;
    text-align: center;
}

.perc-musician {
    font-weight: 600;
    color: #059669;
    min-width: 50px;
    text-align: right;
}

/* ── 管理員切換器 ── */
.admin-sw-btn {
    transition: all 0.2s ease;
}

.admin-sw-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

/* ── 練習統計（指揮模式）── */
.ps-group-header {
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-light));
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.92em;
    color: var(--primary);
    margin-top: 12px;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid var(--primary-border);
}

.ps-group-header:first-child {
    margin-top: 0;
}

.ps-member-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 11px 14px;
    background: #fff;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 0.92em;
    transition: background 0.15s;
    text-align: left;
}

.ps-member-btn:hover {
    background: #f8fafc;
}

.ps-member-btn.ps-expanded {
    background: var(--primary-bg);
    border-bottom-color: var(--primary-light);
}

.ps-member-name {
    font-weight: 600;
    color: #334155;
}

.ps-member-rate {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 0.9em;
}

.ps-rate-value {
    font-weight: 700;
    color: var(--primary);
    min-width: 38px;
    text-align: right;
}

.ps-rate-detail {
    color: #94a3b8;
    font-size: 0.85em;
}

.ps-arrow {
    color: #94a3b8;
    margin-left: 4px;
    font-size: 0.85em;
    transition: transform 0.2s;
}

.ps-member-detail {
    background: var(--primary-bg);
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
}

.ps-song-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.ps-song-table thead tr {
    background: #f1f5f9;
}

.ps-song-table th {
    padding: 6px 12px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.ps-song-table th:first-child {
    text-align: left;
}

.ps-song-name {
    padding: 7px 12px;
    color: #334155;
    border-bottom: 1px solid #f0f0f0;
}

.ps-song-count {
    padding: 7px 12px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid #f0f0f0;
}

.ps-song-total {
    padding: 7px 12px;
    text-align: center;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #f0f0f0;
}