/* ==========================================================================
   Beulah Choir Portal — Dark Studio Theme (spec revision)
   Palette:  #121212 canvas / #1e1e1e surfaces
   Accents:  #00E676 primary, #3F51B5 secondary
   Motion:   cubic-bezier(0.4, 0, 0.2, 1)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Design Tokens
   -------------------------------------------------------------------------- */
:root {
    --bg-body:      #121212;
    --bg-surface:   #1e1e1e;
    --bg-elevated:  #242424;
    --bg-input:     #181818;

    --accent:        #00E676;
    --accent-soft:   rgba(0, 230, 118, 0.14);
    --accent-border: rgba(0, 230, 118, 0.38);

    --indigo:        #3F51B5;
    --indigo-hover:  #5c6bc0;
    --indigo-soft:   rgba(63, 81, 181, 0.18);

    --text-primary:   #ececee;
    --text-secondary: #9e9ea6;
    --text-muted:     #6e6e78;

    --danger:  #ef5350;
    --warning: #ffb74d;
    --success: #66bb6a;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.3, 0.4, 1);

    --header-h: 64px;
    --dock-h:   168px;
}

/* --------------------------------------------------------------------------
   1. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

html.lock-viewport,
html.lock-viewport body {
    height: 100vh;
    height: 100dvh;        /* mobile browsers: excludes collapsing URL bar */
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a         { color: var(--accent); text-decoration: none; transition: color 200ms var(--ease); }
a:hover   { color: #4dff9c; }
button    { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* --------------------------------------------------------------------------
   2. App Shell — 100vh grid: header / main / dock
   -------------------------------------------------------------------------- */
#app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "header"
        "main";
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    width: 100%;
    background: var(--bg-body);
}
#app-shell > * { min-width: 0; }

/* ---- Header ---- */
#app-header {
    grid-area: header;
    background: var(--bg-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 20;
}

.app-header-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0 1.1rem;
    height: var(--header-h);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.app-logo:hover { color: var(--text-primary); }

.app-logo-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--indigo));
    color: #0d0d0d;
    font-size: 1.05rem;
}

.app-logo-text { font-size: 1.05rem; }

/* View toggles */
.view-toggles {
    display: flex;
    gap: 0.35rem;
    margin-left: 0.5rem;
}

.view-toggle {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    border: 1px solid transparent;
    transition: all 220ms var(--ease);
}
.view-toggle:hover { color: var(--text-primary); background: var(--bg-elevated); }
.view-toggle.is-active {
    color: #0d0d0d;
    background: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-border), 0 4px 14px rgba(0, 230, 118, 0.22);
}

.app-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: right;
    font-size: 0.9rem;
}
.user-badge small {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.logout-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
}
.logout-link:hover { color: var(--danger); background: rgba(239, 83, 80, 0.1); }

/* Schedule bar */
.schedule-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 1.1rem;
    background: linear-gradient(90deg, rgba(63, 81, 181, 0.16), rgba(0, 230, 118, 0.08));
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: nowrap;
}

.schedule-icon { font-size: 1rem; }
.schedule-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}
.schedule-date { color: var(--text-primary); font-weight: 600; }

.schedule-chip {
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 200ms var(--ease);
}
.schedule-chip:hover {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
.schedule-notes { color: var(--warning); font-style: italic; }
.schedule-empty { color: var(--text-muted); }

/* ---- Main content ---- */
#main-content {
    grid-area: main;
    overflow-y: auto;
    overflow-x: hidden;
    /** Reserve room so content never hides behind the fixed mixer dock. */
    padding: 1.2rem 1.2rem calc(var(--dock-h) + 1.4rem + env(safe-area-inset-bottom));
    scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   3. Auth pages
   -------------------------------------------------------------------------- */
.auth-shell {
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h));
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(60% 40% at 50% 0%, rgba(0, 230, 118, 0.07), transparent 60%),
        radial-gradient(50% 40% at 80% 100%, rgba(63, 81, 181, 0.09), transparent 60%),
        var(--bg-body);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-lg);
    padding: 2.2rem 2rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    animation: rise-in 500ms var(--ease) both;
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    border-radius: 14px;
    font-size: 1.5rem;
    color: #0d0d0d;
    background: linear-gradient(135deg, var(--accent), var(--indigo));
}

.auth-title { text-align: center; font-size: 1.35rem; }
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0.2rem 0 1.6rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.field input,
.search-input,
.schedule-input,
.role-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.field input:focus,
.search-input:focus,
.schedule-input:focus,
.role-select:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 200ms var(--ease);
}

.btn-primary {
    background: var(--accent);
    color: #0d0d0d;
    box-shadow: 0 4px 14px rgba(0, 230, 118, 0.25);
}
.btn-primary:hover {
    background: #33f08c;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 230, 118, 0.32);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.btn-danger {
    background: rgba(239, 83, 80, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 83, 80, 0.3);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-block { width: 100%; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }

/* --------------------------------------------------------------------------
   5. Panels & repertoire
   -------------------------------------------------------------------------- */
.page-panel {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    animation: rise-in 400ms var(--ease) both;
}

.panel-head {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin-bottom: 1rem;
}
.panel-title { font-size: 1.2rem; }
.panel-count { color: var(--text-muted); font-size: 0.82rem; }

.search-input { margin-bottom: 1.4rem; }

.song-group { margin-bottom: 1.6rem; }
.song-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    margin-bottom: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.song-group-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
}

.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.7rem;
}

.song-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 220ms var(--ease);
}
.song-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-border);
    background: linear-gradient(160deg, var(--bg-elevated), rgba(0, 230, 118, 0.05));
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.song-hymn {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.08em;
}
.song-title { font-weight: 600; font-size: 0.95rem; }
.song-meta { font-size: 0.75rem; color: var(--text-muted); }

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}
.empty-state code { color: var(--accent); background: var(--bg-elevated); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* --------------------------------------------------------------------------
   6. Split-screen music viewer (lyrics | PDF)
   -------------------------------------------------------------------------- */
.split-panel { padding: 1.1rem; }

.split-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.split-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}
.song-hymn-lg {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0d0d0d;
    background: var(--accent);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    letter-spacing: 0.05em;
}
.split-title { font-size: 1.25rem; }
.split-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-elevated);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.split-body {
    display: grid;
    grid-template-columns: minmax(280px, 2fr) minmax(320px, 3fr);
    gap: 1rem;
    height: calc(100vh - var(--header-h) - var(--dock-h) - 10.5rem);
    height: calc(100dvh - var(--header-h) - var(--dock-h) - 10.5rem);
    min-height: 320px;
}

.split-lyrics {
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    overflow-y: auto;
}

.lyric-line {
    margin-bottom: 0.9rem;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-primary);
    font-weight: 500;
}

.split-score {
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
}

.score-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #2b2b2b;
}

.score-empty {
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 2.4rem;
}
.score-empty p { font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   7. Admin roster
   -------------------------------------------------------------------------- */
.admin-panel { max-width: 1100px; }

.table-wrap { overflow-x: auto; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: var(--radius-md); }

.roster-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

.roster-table th {
    text-align: left;
    padding: 0.7rem 0.9rem;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.roster-table td {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.roster-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.row-unverified td { background: rgba(255, 183, 77, 0.04); }
.td-name { font-weight: 600; }
.td-actions { white-space: nowrap; }

.inline-form { display: inline-block; margin-right: 0.35rem; }

.role-select { width: auto; padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.04em;
}
.badge-ok   { color: #0d0d0d; background: var(--accent); }
.badge-warn { color: #1c1405; background: var(--warning); }

.muted { color: var(--text-muted); }

.admin-section { margin-top: 1.8rem; }

.schedule-form {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
    align-items: center;
}
.schedule-input { width: auto; min-width: 150px; }

.upcoming-list {
    list-style: none;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.9rem;
}
.upcoming-list em { color: var(--warning); font-size: 0.8rem; margin-left: 0.5rem; }

/* ---- Schedule planner: searchable multi-song picker ---- */
.schedule-builder {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 260px;
    gap: 1rem;
    align-items: start;
}
.schedule-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}
.schedule-picker .search-input { margin-bottom: 0; }
.schedule-picker-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.schedule-selall {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}
.schedule-selall input,
.schedule-song-item input {
    accent-color: var(--accent);
    width: auto;
}
.schedule-count { color: var(--accent); font-weight: 600; }
.schedule-song-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
}
.schedule-song-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: background 150ms var(--ease);
}
.schedule-song-item:last-child { border-bottom: none; }
.schedule-song-item:hover { background: var(--accent-soft); }
.schedule-song-item.is-checked { background: var(--accent-soft); }
.schedule-song-item strong {
    color: var(--text-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-song-item .song-genre {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}
.schedule-meta {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.schedule-meta .schedule-input { width: 100%; min-width: 0; }

/* ---- Notification bell (header) ---- */
.notif-bell {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    transition: color 200ms var(--ease), border-color 200ms var(--ease), background 200ms var(--ease);
}
.notif-bell:hover { color: var(--accent); border-color: var(--accent-border); }
.notif-bell:disabled { opacity: 0.5; cursor: wait; }
.notif-bell.is-on {
    color: #0d0d0d;
    background: linear-gradient(135deg, var(--accent), var(--indigo));
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(0, 230, 118, 0.35);
}

/* ---- Schedule reminder bar (admin) ---- */
.schedule-reminder-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0.55rem 0.8rem;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ---- Upcoming services (grouped cards) ---- */
.upcoming-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--indigo);
    padding: 0.6rem 0.9rem;
}
.upcoming-date {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}
.upcoming-date strong { color: var(--text-primary); }
.upcoming-notes { color: var(--warning); font-size: 0.8rem; font-style: italic; }
.upcoming-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.upcoming-card li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.upcoming-song { font-weight: 500; color: var(--text-secondary); }
.practice-stat {
    color: var(--accent);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---- Table helpers ---- */
.th-center, .td-center { text-align: center; }
.push-dot { font-size: 1.05rem; filter: grayscale(0); }
.push-summary { margin-left: auto; }

/* ---- Practice stats line ---- */
.practice-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
    padding: 0.7rem 0.9rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/* --------------------------------------------------------------------------
   8. Flash messages
   -------------------------------------------------------------------------- */
.flash-bar {
    max-width: 1200px;
    margin: 0 auto 1rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: rise-in 300ms var(--ease) both;
}
.flash-success { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); }
.flash-info    { background: var(--indigo-soft); border: 1px solid rgba(63, 81, 181, 0.4); color: #9fb0ff; }
.flash-warning { background: rgba(255, 183, 77, 0.12); border: 1px solid rgba(255, 183, 77, 0.35); color: var(--warning); }
.flash-danger  { background: rgba(239, 83, 80, 0.12); border: 1px solid rgba(239, 83, 80, 0.35); color: var(--danger); }

.flash-close { color: inherit; opacity: 0.6; font-size: 1.1rem; line-height: 1; }
.flash-close:hover { opacity: 1; }

.error-msg { color: var(--danger); }

/* --------------------------------------------------------------------------
   9. Studio Mixer Dock
   -------------------------------------------------------------------------- */
#studio-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 0.9rem;
    align-items: center;
    padding: 0.7rem 1.1rem calc(0.7rem + env(safe-area-inset-bottom));
    min-height: var(--dock-h);
    z-index: 40;
    transform: translateY(0);
    transition: transform 280ms var(--ease), visibility 280ms;
    will-change: transform;
}
/* Auto-hide: slide the dock below the screen after a few idle seconds
   (re-shown on any interaction — see :root.dock-hidden in app.js). */
html.dock-hidden #studio-dock {
    transform: translateY(calc(100% + env(safe-area-inset-bottom) + 10px));
    visibility: hidden;
    pointer-events: none;
}

/* Dock is fixed/out-of-flow, so each panel gets an expand affordance. */
.split-lyrics, .split-score { position: relative; }

.panel-expand {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.panel-expand svg { width: 17px; height: 17px; }
.panel-expand:hover, .panel-expand:focus-visible { opacity: 1; color: var(--accent); border-color: var(--accent-border); }
.split-lyrics:hover .panel-expand,
.split-score:hover .panel-expand { opacity: 1; }
@media (hover: none) {
    .panel-expand { opacity: 0.85; }
}

/* Slim trace bar shown while the dock is hidden */
#dock-peek {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 39;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem calc(0.4rem + env(safe-area-inset-bottom));
    background: var(--bg-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    animation: rise-in 200ms var(--ease) both;
}
html.dock-hidden #dock-peek { display: flex; }

.peek-title {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.peek-btn, .peek-play {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.95rem;
    transition: all 180ms var(--ease);
}
.peek-btn:hover { color: var(--accent); border-color: var(--accent-border); }
.peek-play {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #0d0d0d;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(0, 230, 118, 0.3);
}
.peek-play:hover { background: #33f08c; }

/* Track info */
#dock-track-info { display: flex; flex-direction: column; min-width: 0; }
#dockTitle {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#dockMeta { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Transport */
#dock-transport { display: flex; align-items: center; gap: 0.5rem; }

.dock-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    transition: all 200ms var(--ease);
}
.dock-btn:hover { border-color: var(--accent-border); color: var(--accent); }
.dock-btn.is-active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

.dock-play-btn {
    width: 54px;
    height: 54px;
    background: var(--accent);
    color: #0d0d0d;
    font-size: 1.15rem;
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.35);
}
.dock-play-btn:hover { background: #33f08c; color: #0d0d0d; transform: scale(1.05); }

/* Timeline */
#dock-timeline {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 220px;
}
.dock-time { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

#dockProgress {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 5px;
    border-radius: 4px;
    background: var(--bg-elevated);
    outline: none;
}
#dockProgress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

/* Fader rack */
#dock-faders {
    display: flex;
    gap: 0.55rem;
    align-items: flex-end;
}

.dock-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 220ms var(--ease);
}
.dock-channel:hover { background: var(--bg-elevated); border-color: rgba(255, 255, 255, 0.06); }
.dock-channel.is-missing { opacity: 0.35; }
.dock-channel.is-missing .dock-fader { opacity: 0.4; }

.dock-channel-value {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.dock-fader {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 26px;
    height: 96px;
    background: var(--bg-input);
    border-radius: 6px;
    outline: none;
    transition: all 200ms var(--ease);
}
.dock-fader:hover { box-shadow: 0 0 0 2px var(--accent-soft); }

.dock-channel-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    #studio-dock {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info transport"
            "timeline timeline"
            "faders faders";
    }
    #dock-track-info { grid-area: info; }
    #dock-transport  { grid-area: transport; }
    #dock-timeline   { grid-area: timeline; }
    #dock-faders     { grid-area: faders; justify-content: center; }
}

@media (max-width: 760px) {
    :root { --header-h: 58px; --dock-h: 190px; }

    .app-header-row { flex-wrap: wrap; height: auto; padding: 0.55rem 0.8rem; gap: 0.5rem; }
    .app-logo-text { display: none; }
    .view-toggles { order: 3; width: 100%; justify-content: center; margin-left: 0; }
    .user-badge { display: none; }

    .schedule-bar { padding: 0.4rem 0.8rem; }

    #main-content { padding: 0.8rem 0.8rem calc(var(--dock-h) + 1.2rem + env(safe-area-inset-bottom)); }

    .split-body {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }
    .split-lyrics { max-height: 40vh; max-height: 40dvh; }
    .split-score { height: 55vh; height: 55dvh; }

    .song-grid { grid-template-columns: 1fr 1fr; }

    .schedule-form { flex-direction: column; align-items: stretch; }
    .schedule-input { width: 100%; }
    .schedule-builder { grid-template-columns: 1fr; }

    #studio-dock { padding: 0.6rem 0.7rem calc(0.6rem + env(safe-area-inset-bottom)); }
    #dock-peek { padding: 0.4rem 0.7rem calc(0.4rem + env(safe-area-inset-bottom)); }
    .dock-fader { height: 72px; width: 22px; }
    #dock-timeline { min-width: 0; }

    /* iOS standalone: keep content clear of the notch & home indicator */
    #app-header {
        padding-top: env(safe-area-inset-top);
    }
    #studio-dock {
        padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
    }
    #main-content {
        padding-bottom: calc(var(--dock-h) + 1.2rem + env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    :root { --dock-h: 174px; }
    .dock-fader { height: 56px; }
    #dock-transport .dock-btn { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
    #dockProgress { min-width: 0; }
}

/* --------------------------------------------------------------------------
   11. Enterprise auth (v2)
   -------------------------------------------------------------------------- */
.standalone-auth { background: var(--bg-body); }
.auth-card-wide { max-width: 460px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.2rem 0 0.9rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: #ffffff;
    color: #202124;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-google:hover { background: #f1f3f4; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }

.auth-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auth-links a { color: var(--accent); }
.auth-sep { opacity: 0.4; }

.dev-token-box {
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    border: 1px dashed rgba(0, 230, 118, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(0, 230, 118, 0.05);
    font-size: 0.82rem;
    line-height: 1.6;
    display: grid;
    gap: 0.3rem;
}
.dev-token-box a { color: var(--accent); font-weight: 700; word-break: break-all; }
.dev-token-box code {
    color: var(--text-muted);
    font-size: 0.72rem;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   12. Admin Suite (v2) — AI, uploader/trimmer, activity matrix
   -------------------------------------------------------------------------- */
.admin-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0.2rem 0 0.6rem;
}

/* Converter availability pills on the uploader */
.admin-hint-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: -0.25rem;
}
.converter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}
.converter-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    flex: 0 0 auto;
}
.converter-pill.is-ready {
    color: var(--text-primary);
    border-color: rgba(0, 230, 118, 0.28);
}
.converter-pill.is-ready::before {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

/* ---- AI recommender ---- */
.ai-results { margin-top: 0.9rem; display: grid; gap: 0.7rem; }
.ai-engine { font-size: 0.74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.ai-card {
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    animation: rise-in 300ms var(--ease) both;
}
.ai-card-head { display: flex; align-items: center; gap: 0.8rem; }
.ai-card-head .song-hymn-lg { font-size: 1.2rem; min-width: 2.6rem; }
.ai-card-title { flex: 1; min-width: 0; }
.ai-card-title a { color: var(--text-bright); font-weight: 700; font-size: 0.95rem; text-decoration: none; }
.ai-card-title a:hover { text-decoration: underline; }
.ai-card-title small { display: block; color: var(--text-muted); font-size: 0.74rem; }

.ai-score {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--accent);
}
.ai-scorebar { height: 5px; background: var(--bg-input); border-radius: 999px; margin: 0.5rem 0 0.35rem; overflow: hidden; }
.ai-scorebar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.ai-reason { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Uploader & waveform trimmer ---- */
.upload-grid { display: grid; grid-template-columns: 1fr 2fr 1.5fr; gap: 0.8rem; }

.stem-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
    margin-top: 1rem;
}
.stem-cell {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stem-cell.is-full { grid-column: 1 / -1; }
.stem-cell label.field-label em { color: var(--accent); font-style: normal; }

.stem-input {
    font-size: 0.74rem;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    width: 100%;
}
.stem-input::file-selector-button {
    background: var(--bg-elevated);
    color: var(--text-bright);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    margin-right: 0.6rem;
    cursor: pointer;
}

.waveform {
    width: 100%;
    height: 70px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: var(--bg-body);
}

.trim-meta { font-size: 0.72rem; color: var(--text-muted); }
.trim-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.trim-controls label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; }
.trim-controls input[type="number"] {
    width: 4.5rem;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-bright);
    padding: 0.2rem 0.3rem;
    font-size: 0.72rem;
}

.upload-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.1rem; }
.upload-status { font-size: 0.82rem; color: var(--text-muted); }
.upload-status.is-ok  { color: var(--accent); font-weight: 700; }
.upload-status.is-err { color: var(--danger, #ff6b6b); font-weight: 700; }

/* ---- Activity matrix ---- */
.presence-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.55;
    margin-right: 0.45rem;
    vertical-align: 1px;
}
.presence-dot.is-online { background: var(--accent); opacity: 1; box-shadow: 0 0 8px rgba(0, 230, 118, 0.6); }

.badge-online { color: #04210f; background: var(--accent); }

.practice-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
    font-size: 0.8rem;
}

@media (max-width: 760px) {
    .upload-grid { grid-template-columns: 1fr 1fr; }
    .stem-fields { grid-template-columns: 1fr 1fr; }
    .ai-card-head { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   13. Choral Repertoire System (v3) — filters, lifecycle badges, song manager
   -------------------------------------------------------------------------- */
/* ---- Filter toolbar ---- */
.filter-toolbar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}
.filter-toolbar .search-input { margin-bottom: 0; flex: 1 1 260px; }

.filter-select {
    min-width: 160px;
    background: var(--bg-input);
    color: var(--text-bright);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.filter-select:hover, .filter-select:focus { border-color: var(--accent-border); outline: none; }

/* ---- Song card badges & composer ---- */
.song-card-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
    min-height: 0.8rem;
}

.badge-learn { color: #1c1405; background: var(--warning); }
.badge-arch  { color: #0d0d0d; background: #8b8b93; }
.badge-genre {
    color: #dbe4ff;
    background: rgba(96, 125, 242, 0.22);
    border: 1px solid rgba(96, 125, 242, 0.4);
    text-transform: none;
    letter-spacing: 0;
}

.song-composer {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.split-composer {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ---- Song manager ---- */
.song-manager-wrap { max-height: 480px; overflow-y: auto; }
.song-manager-table .td-name strong { display: flex; align-items: center; gap: 0.5rem; }

.status-toggle {
    background: var(--bg-input);
    color: var(--text-bright);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.status-toggle:focus { outline: none; border-color: var(--accent-border); }
.status-toggle[data-status="learning"] { border-color: rgba(255, 179, 71, 0.55); }
.status-toggle[data-status="mastered"] { border-color: rgba(0, 230, 118, 0.55); }

.store-state { margin-left: 0.5rem; font-size: 0.78rem; font-weight: 700; }
.store-state.store-pending { color: var(--text-muted); }
.store-state.store-ok  { color: var(--accent); }
.store-state.store-err { color: var(--danger, #ff6b6b); max-width: 8rem; }

/* ---- Edit modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    animation: fade-in 200ms var(--ease) both;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
    width: 100%;
    max-width: 560px;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
    animation: rise-in 240ms var(--ease) both;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.modal-head h3 { font-size: 1.05rem; }
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { color: var(--text-bright); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.edit-status { font-size: 0.82rem; margin-top: 0.5rem; }
.edit-status.is-err { color: var(--danger, #ff6b6b); }

.modal-card-wide { max-width: 720px; }
.audio-song-sub { font-size: 0.82rem; margin: -0.4rem 0 0.9rem; }

.audio-stem-rows { display: grid; gap: 0.55rem; max-height: 58vh; overflow-y: auto; }
.audio-stem-row {
    display: grid;
    grid-template-columns: minmax(92px, 150px) minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}
.audio-stem-name { font-weight: 700; font-size: 0.85rem; }
.audio-stem-file {
    font-size: 0.76rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
}
.audio-stem-file.is-missing { color: var(--danger, #ff6b6b); }
.audio-stem-input { font-size: 0.76rem; max-width: 220px; }
.audio-stem-state { font-size: 0.76rem; font-weight: 600; min-width: 52px; }
.audio-stem-state.is-ok  { color: var(--accent, #00e676); }
.audio-stem-state.is-err { color: var(--danger, #ff6b6b); }

@media (max-width: 620px) {
    .audio-stem-row { grid-template-columns: 1fr auto; }
    .audio-stem-file { grid-column: 1 / -1; direction: ltr; }
    .audio-stem-input { grid-column: 1 / -1; max-width: none; }
}

.field-title-hint { font-size: 0.74rem; }

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.upload-grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (max-width: 760px) {
    .filter-toolbar .filter-select { flex: 1 1 140px; }
    .modal-card { padding: 1rem; }
}


/* Voice-part badge (admin roster) */
.part-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   14. Fullscreen viewer — scores & lyrics (click / double-click)
   -------------------------------------------------------------------------- */
#fullscreen-view {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    background: #0b0b0b;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: fade-in 180ms var(--ease) both;
}
#fullscreen-view[hidden] { display: none; }

.fullscreen-sheet {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.fullscreen-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    transition: all 180ms var(--ease);
}
.fullscreen-close:hover { background: var(--accent); color: #0d0d0d; border-color: var(--accent); }
.fullscreen-close svg { width: 20px; height: 20px; }

#fullscreenBody { height: 100%; overflow: auto; }

.fs-lyrics {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.4rem calc(2rem + env(safe-area-inset-bottom));
    font-size: 1.4rem;
    line-height: 1.75;
}
.fs-lyrics .lyric-line {
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    font-weight: 500;
}

.fs-score { width: 100%; height: 100%; }
.fs-score-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #2b2b2b;
}

/* Dock hidden: keep the slim trace bar visible — reserve its height so
   content still clears it (replaces the full-dock reserve above). */
html.dock-hidden #main-content {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
    #studio-dock { transition: none; }
    #fullscreen-view { animation: none; }
}

/* --------------------------------------------------------------------------
   15. Admin sub-page tabs
   -------------------------------------------------------------------------- */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.4rem;
}
.admin-tab {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 180ms var(--ease);
}
.admin-tab:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.admin-tab.is-active {
    color: #0d0d0d;
    background: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 420px) {
    .admin-tab { flex: 1 1 40%; text-align: center; }
}

/* --------------------------------------------------------------------------
   16. Repertoire allocation tabs & offline playlist
   -------------------------------------------------------------------------- */
.repertoire-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    padding-bottom: 0.8rem;
}
.repertoire-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 180ms var(--ease);
}
.repertoire-tab:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.repertoire-tab.is-active {
    color: #0d0d0d;
    background: linear-gradient(135deg, var(--accent), #00c853);
    border-color: var(--accent);
    box-shadow: 0 2px 14px rgba(0, 230, 118, 0.28);
}
.repertoire-tab-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.22);
}
.repertoire-tab:not(.is-active) .repertoire-tab-count {
    background: var(--bg-input);
    color: var(--text-muted);
}

/* Allocation badges */
.badge-lineup {
    color: #1c1405;
    background: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.55);
}
.badge-rehearsal {
    color: #dbe4ff;
    background: rgba(96, 125, 242, 0.28);
    border: 1px solid rgba(96, 125, 242, 0.5);
}
.badge-vault {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.song-target-date {
    font-size: 0.74rem;
    color: #FFD700;
    font-weight: 600;
}

/* Offline playlist bar */
.offline-playlist-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background:
        radial-gradient(120% 160% at 0% 0%, rgba(255, 215, 0, 0.12), transparent 60%),
        var(--bg-elevated);
    border: 1px solid rgba(255, 215, 0, 0.28);
}
.offline-playlist-copy { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem; }
.offline-playlist-copy strong { color: #FFD700; }
.offline-playlist-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.offline-playlist-status { font-size: 0.8rem; color: var(--accent); }

/* --------------------------------------------------------------------------
   17. Admin scheduling, allocation & forgotten gems
   -------------------------------------------------------------------------- */
.schedule-field { display: flex; flex-direction: column; gap: 0.25rem; }
.schedule-field .field-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.schedule-field-notes { flex: 1 1 160px; }
.schedule-meta .schedule-field { min-width: 0; }

.upcoming-actions { margin-top: 0.5rem; }

.past-services-title { margin-top: 1.8rem; }
.past-services-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.8rem;
    font-size: 0.88rem;
}
.past-services-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.7rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.td-allocation { min-width: 190px; }
.allocation-toggle,
.allocation-date {
    background: var(--bg-input);
    color: var(--text-bright);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
}
.allocation-date { margin-top: 0.3rem; display: block; width: 100%; max-width: 150px; }
.allocation-toggle:focus,
.allocation-date:focus { outline: none; border-color: var(--accent-border); }
.allocation-toggle[data-allocation="Sabbath Lineup"] { border-color: rgba(255, 215, 0, 0.55); }
.allocation-toggle[data-allocation="Upcoming Rehearsal"] { border-color: rgba(96, 125, 242, 0.55); }

.ai-gems-results { margin-top: 1.4rem; }
.ai-gem-card { border-left: 3px solid #FFD700; }
.ai-gem-card .ai-score { color: #FFD700; }

@media (max-width: 720px) {
    .schedule-builder { grid-template-columns: 1fr; }
    .offline-playlist-bar { flex-direction: column; align-items: flex-start; }
    .td-allocation { min-width: 150px; }
}

/* ==========================================================================
   SPOTIFY-STYLE SKIN (v6)
   --------------------------------------------------------------------------
   Appended after the base theme so it wins the cascade. Rebuilds the shell
   as: black canvas -> left sidebar -> rounded content view -> now-playing
   bar with the 5-channel mixer. Palette follows the product spec
   (#121212 / #181818 / #1DB954 / #FFD700).
   ========================================================================== */

:root {
    /* Surfaces */
    --bg-base:      #000000;
    --bg-body:      #121212;
    --bg-surface:   #181818;
    --bg-elevated:  #242424;
    --bg-input:     #242424;
    --bg-highlight: #2a2a2a;

    /* Brand */
    --accent:        #1DB954;
    --accent-hover:  #1ED760;
    --accent-soft:   rgba(29, 185, 84, 0.16);
    --accent-border: rgba(29, 185, 84, 0.45);
    --gold:          #FFD700;

    /* Legacy aliases — older admin styles stay on-brand */
    --indigo:        #1DB954;
    --indigo-hover:  #1ED760;
    --indigo-soft:   rgba(29, 185, 84, 0.12);

    /* Text */
    --text-primary:   #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted:     #8f8f8f;
    --text-bright:    #ffffff;

    /* Status */
    --danger:  #f15e6c;
    --warning: #ffa42b;
    --success: #1ed760;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --font-sans: 'Circular Std', 'Inter', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --ease: cubic-bezier(0.3, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);

    --header-h: 64px;
    --dock-h: 104px;
    --sidebar-w: 260px;
    --border: rgba(255, 255, 255, 0.1);
}

/* ---- Base ---- */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: var(--bg-base); color: var(--text-primary); }

.icon { width: 20px; height: 20px; flex: none; display: block; }

::selection { background: rgba(29, 185, 84, 0.35); color: #fff; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4d4d4d; border: 3px solid transparent; background-clip: content-box; border-radius: 12px; }
::-webkit-scrollbar-thumb:hover { background: #6a6a6a; background-clip: content-box; }

a { color: #fff; }
a:hover { color: #fff; text-decoration: underline; }

/* ---- Shell: sidebar | view, dock pinned below ---- */
#app-shell { background: var(--bg-base); width: 100%; height: 100dvh; }

#app-shell.is-auth {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: none;
    gap: 8px;
    height: 100dvh;
    padding: 8px 8px calc(var(--dock-h) + 8px) 0;
    overflow: hidden;
}

#app-shell.is-guest {
    display: block;
    height: auto;
    min-height: 100dvh;
    padding: 0;
    background: var(--bg-base);
}

/* ---- Sidebar ---- */
#app-sidebar {
    grid-area: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    min-width: 0;
}

.side-card { background: #121212; border-radius: 10px; padding: 12px; }
.side-card--nav { padding: 10px 10px 14px; }

.side-card--library {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 4px 4px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 14px;
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.app-logo:hover { color: #fff; text-decoration: none; }

.app-logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #000;
}
.app-logo-icon .icon { width: 19px; height: 19px; }
.app-logo-text { font-size: 1.02rem; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.side-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: color 150ms var(--ease), background 150ms var(--ease);
}
.side-link .icon { width: 23px; height: 23px; }
.side-link:hover { color: #fff; text-decoration: none; }
.side-link.is-active { color: #fff; }
.side-link.is-active .icon { color: var(--accent); }
.side-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.side-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 0.94rem;
    font-weight: 700;
}
.side-heading .icon { width: 22px; height: 22px; }

.side-playlists {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    padding: 0 4px;
    overflow-y: auto;
    min-height: 0;
}

.side-playlist {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 150ms var(--ease), color 150ms var(--ease);
}
.side-playlist:hover { background: #1a1a1a; color: #fff; text-decoration: none; }
.side-playlist.is-active { background: #1f1f1f; color: #fff; }

.side-playlist-art {
    width: 38px;
    height: 38px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    color: rgba(0, 0, 0, 0.85);
    flex: none;
}
.side-playlist-art .icon { width: 18px; height: 18px; }
.art-gold   { background: linear-gradient(135deg, #FFD700, #a67c00); }
.art-green  { background: linear-gradient(135deg, #1DB954, #0b6b33); }
.art-violet { background: linear-gradient(135deg, #a855f7, #4c1d95); color: #fff; }

.side-playlist-text { display: flex; flex-direction: column; min-width: 0; }
.side-playlist-text strong {
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-playlist-text small { font-size: 0.72rem; color: var(--text-muted); }

.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 10px 10px 6px;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #535353;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.76rem;
    font-weight: 800;
    flex: none;
    letter-spacing: 0.02em;
}

.side-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }

.user-badge {
    display: block;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-user-role { font-size: 0.68rem; color: var(--text-muted); text-transform: capitalize; }

.side-logout {
    margin-left: auto;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-muted);
    display: grid;
    place-items: center;
}
.side-logout:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.side-logout .icon { width: 18px; height: 18px; }

/* ---- Content view ---- */
#app-view {
    grid-area: auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: var(--bg-body);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.is-guest #app-view {
    display: block;
    border-radius: 0;
    background: var(--bg-base);
    min-height: 100dvh;
    height: auto;
}

/* ---- Top bar ---- */
#app-header {
    grid-area: auto;
    background: rgba(18, 18, 18, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 0;
    z-index: 20;
}

.app-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--header-h);
    padding: 0 20px;
}

.history-btns { display: flex; gap: 8px; }

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 0;
    display: grid;
    place-items: center;
    transition: background 150ms var(--ease);
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.sidebar-toggle { display: none; }

.app-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Next-service pill */
.schedule-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(520px, 42vw);
    padding: 6px 14px;
    border-radius: 999px;
    background: #1f1f1f;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
}
.schedule-icon { display: grid; place-items: center; color: var(--gold); }
.schedule-icon .icon { width: 15px; height: 15px; }
.schedule-label {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.schedule-date { color: #fff; font-weight: 700; }
.schedule-songs { display: flex; gap: 6px; overflow: hidden; }
.schedule-chip {
    background: #2a2a2a;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 2px 10px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
    text-decoration: none;
}
.schedule-chip:hover { background: #333; color: #fff; text-decoration: none; }
.schedule-notes, .schedule-empty { color: var(--text-muted); }

.notif-bell {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    font-size: 0;
    transition: color 150ms var(--ease), background 150ms var(--ease);
}
.notif-bell .icon { width: 19px; height: 19px; }
.notif-bell:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.notif-bell:disabled { opacity: 0.5; cursor: wait; }
.notif-bell.is-on { color: var(--accent); background: transparent; border: 0; box-shadow: none; }

.logout-link {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 7px 14px;
    border: 1px solid #4d4d4d;
    border-radius: 999px;
    white-space: nowrap;
    text-decoration: none;
}
.logout-link:hover { color: #fff; border-color: #fff; text-decoration: none; }

/* ---- Scroll area ---- */
#main-content {
    grid-area: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 24px 48px;
    scroll-behavior: smooth;
    background: var(--bg-body);
}
html.dock-hidden #main-content { padding-bottom: 48px; }
.is-guest #main-content { padding: 0; overflow: visible; }

.page-panel {
    max-width: none;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    animation: none;
}

/* ---- Playlist hero ---- */
.page-hero {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin: 0 -24px;
    padding: 28px 24px 24px;
    background: linear-gradient(180deg, rgba(29, 185, 84, 0.26), rgba(18, 18, 18, 0) 88%);
}
.page-hero-art {
    width: clamp(120px, 16vw, 190px);
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: rgba(0, 0, 0, 0.85);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
    flex: none;
}
.page-hero-art .icon { width: 44%; height: 44%; stroke-width: 1.4; }
.hero-art--gold   { background: linear-gradient(135deg, #FFD700, #a67c00); }
.hero-art--green  { background: linear-gradient(135deg, #1DB954, #0b6b33); }
.hero-art--violet { background: linear-gradient(135deg, #a855f7, #4c1d95); color: rgba(255, 255, 255, 0.9); }

.page-kicker {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #fff;
}
.page-title {
    margin: 0.4rem 0 0.6rem;
    font-size: clamp(2rem, 5vw, 4.2rem);
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1.02;
    color: #fff;
}
.page-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.page-meta strong { color: #fff; font-weight: 700; }
.meta-dot { opacity: 0.5; }

/* ---- Actions / chips ---- */
.page-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
}

.repertoire-tabs { display: flex; gap: 8px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }

.repertoire-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #242424;
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 150ms var(--ease), color 150ms var(--ease);
}
.repertoire-tab:hover { background: #2e2e2e; color: #fff; border-color: transparent; text-decoration: none; }
.repertoire-tab.is-active { background: #fff; color: #000; box-shadow: none; }

.repertoire-tab-count {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
}
.repertoire-tab.is-active .repertoire-tab-count { background: rgba(0, 0, 0, 0.12); color: #000; }

.offline-playlist-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.offline-playlist-status { font-size: 0.78rem; color: var(--accent); }

.offline-playlist-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 14px 0 4px;
    padding: 14px 16px;
    border-radius: 10px;
    background: linear-gradient(120deg, rgba(255, 215, 0, 0.12), #181818 62%);
    border: 1px solid rgba(255, 215, 0, 0.22);
}
.offline-playlist-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.16);
    color: var(--gold);
    display: grid;
    place-items: center;
    flex: none;
}
.offline-playlist-icon .icon { width: 20px; height: 20px; }
.offline-playlist-copy { display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; color: var(--text-secondary); }
.offline-playlist-copy strong { color: var(--gold); font-size: 0.86rem; }

/* ---- Filters ---- */
.filter-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0 4px; }
.filter-toolbar .search-input { flex: 1 1 260px; margin: 0; }

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 150px;
    padding: 8px 34px 8px 14px;
    border-radius: 999px;
    background-color: #242424;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3b3b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.filter-select:hover { background-color: #2e2e2e; }
.filter-select:focus { outline: none; border-color: #fff; }

.search-input {
    width: 100%;
    background: #242424;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 9px 16px;
    color: #fff;
    font-size: 0.84rem;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { background: #2a2a2a; border-color: #fff; box-shadow: none; outline: none; }

/* ---- Track list ---- */
.song-group { margin: 22px 0 4px; }
.song-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: none;
    color: #fff;
}
.song-group-count {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    background: #242424;
    color: var(--text-secondary);
}

.song-grid { display: flex; flex-direction: column; gap: 2px; }

.song-card {
    display: grid;
    grid-template-columns: 26px 44px minmax(0, 2.4fr) minmax(0, 1.5fr) 92px 36px;
    align-items: center;
    gap: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    background: transparent;
    border: 0;
    color: #fff;
    text-decoration: none;
    transition: background 120ms var(--ease);
}
.song-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border: 0;
    box-shadow: none;
    transform: none;
    color: #fff;
    text-decoration: none;
}

.song-index {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.song-card:hover .song-index { color: #fff; }

.song-art {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: none;
    color: #fff;
}
.song-art .icon { width: 18px; height: 18px; opacity: 0.9; }
.song-art-num {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.song-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.song-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-card:hover .song-title { color: #fff; }
.song-composer {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-card-badges { display: flex; gap: 6px; flex-wrap: wrap; min-height: 0; margin: 0; }
.song-target-date {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--gold);
    white-space: nowrap;
    text-align: right;
}

.song-cta {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: grid;
    place-items: center;
    justify-self: end;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 150ms var(--ease), transform 150ms var(--ease);
}
.song-cta .icon { width: 14px; height: 14px; }
.song-card:hover .song-cta,
.song-card:focus-visible .song-cta { opacity: 1; transform: scale(1); }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-ok        { background: rgba(29, 185, 84, 0.16);  color: #1ed760; border-color: rgba(29, 185, 84, 0.35); }
.badge-learn     { background: rgba(255, 164, 43, 0.14); color: #ffa42b; border-color: rgba(255, 164, 43, 0.32); }
.badge-arch      { background: rgba(255, 255, 255, 0.08); color: #b3b3b3; border-color: rgba(255, 255, 255, 0.1); }
.badge-lineup    { background: rgba(255, 215, 0, 0.14);  color: #FFD700; border-color: rgba(255, 215, 0, 0.32); }
.badge-rehearsal { background: rgba(96, 125, 242, 0.16); color: #a9b8ff; border-color: rgba(96, 125, 242, 0.35); }
.badge-vault     { background: rgba(255, 255, 255, 0.06); color: #a7a7a7; border-color: rgba(255, 255, 255, 0.09); }
.badge-genre     { background: rgba(168, 85, 247, 0.16); color: #c9a5ff; border-color: rgba(168, 85, 247, 0.3); }
.badge-warn      { background: rgba(255, 164, 43, 0.16); color: #ffa42b; border-color: rgba(255, 164, 43, 0.32); }
.badge-online    { background: rgba(29, 185, 84, 0.16);  color: #1ed760; border-color: rgba(29, 185, 84, 0.35); }

/* ---- Empty states ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 56px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #181818;
    color: var(--text-muted);
    display: grid;
    place-items: center;
}
.empty-state-icon .icon { width: 26px; height: 26px; }
.empty-state a { color: #fff; text-decoration: underline; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 150ms var(--ease), background 150ms var(--ease),
                color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); color: #000; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); color: #000; transform: scale(1.03); box-shadow: none; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; border: 1px solid #6a6a6a; color: #fff; }
.btn-ghost:hover { border-color: #fff; color: #fff; background: transparent; }

.btn-danger { background: transparent; border: 1px solid rgba(241, 94, 108, 0.5); color: #f15e6c; }
.btn-danger:hover { background: rgba(241, 94, 108, 0.14); color: #ff8b96; border-color: #f15e6c; }

.btn-block { width: 100%; }
.btn-xs { padding: 5px 12px; font-size: 0.72rem; }

/* ---- Forms ---- */
.field input,
.field select,
.schedule-input,
.role-select,
.allocation-toggle,
.allocation-date,
.status-toggle {
    background: #242424;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 0.62rem 0.85rem;
    color: #fff;
    font-size: 0.85rem;
}
.field input:focus,
.field select:focus,
.schedule-input:focus,
.role-select:focus,
.allocation-toggle:focus,
.allocation-date:focus,
.status-toggle:focus {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
    outline: none;
}
.field-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 700;
}

/* ---- Auth screens ---- */
.auth-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background:
        radial-gradient(90% 60% at 50% -10%, rgba(29, 185, 84, 0.16), transparent 62%),
        #000;
}
.auth-card {
    width: 100%;
    max-width: 392px;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    animation: rise-in 400ms var(--ease) both;
}
.auth-logo {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: grid;
    place-items: center;
}
.auth-logo .icon { width: 26px; height: 26px; }
.auth-title { font-size: 1.9rem; font-weight: 900; letter-spacing: -0.035em; text-align: center; color: #fff; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.86rem; margin: 0.4rem 0 1.8rem; text-align: center; }
.auth-form { gap: 14px; }
.auth-links { color: var(--text-secondary); font-size: 0.82rem; }
.auth-links a { color: #fff; text-decoration: underline; }
.auth-sep { opacity: 0.4; }
.auth-divider { color: var(--text-muted); }
.btn-google { background: #fff; color: #000; border: 0; border-radius: 999px; font-weight: 700; }
.btn-google:hover { background: #f1f1f1; color: #000; box-shadow: none; }

/* ---- Sheet / song view ---- */
.split-panel { padding: 0; }

.split-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin: 0 -24px 18px;
    padding: 28px 24px 20px;
    background: linear-gradient(180deg, rgba(29, 185, 84, 0.22), rgba(18, 18, 18, 0) 90%);
}

.split-title-wrap { display: flex; align-items: flex-end; gap: 20px; min-width: 0; }
.sheet-art {
    width: clamp(96px, 12vw, 150px);
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: grid;
    place-items: center;
    flex: none;
    color: #fff;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.sheet-art .icon { width: 38%; height: 38%; }
.split-title-copy { min-width: 0; }
.split-title {
    font-size: clamp(1.6rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: #fff;
    margin: 0.25rem 0 0.5rem;
}
.split-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.split-composer { display: inline; font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.split-category {
    background: #242424;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

.split-body {
    display: grid;
    grid-template-columns: minmax(280px, 2fr) minmax(320px, 3fr);
    gap: 12px;
    height: calc(100dvh - var(--header-h) - var(--dock-h) - 9.5rem);
    min-height: 320px;
}

.split-lyrics {
    background: #181818;
    border: 0;
    border-radius: 10px;
    padding: 22px 24px;
    overflow-y: auto;
}
.lyric-line { font-size: 1.02rem; line-height: 1.75; color: #e8e8e8; margin-bottom: 0.85rem; font-weight: 400; }

.split-score { background: #0d0d0d; border: 0; border-radius: 10px; }
.score-frame { background: #0d0d0d; }

/* ---- Now playing bar ---- */
#studio-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(300px, 1.9fr) minmax(230px, 1fr);
    align-items: center;
    gap: 16px;
    height: var(--dock-h);
    min-height: 0;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: #181818;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#dock-track-info { display: flex; flex-direction: row; align-items: center; gap: 12px; min-width: 0; }

.dock-art {
    width: 54px;
    height: 54px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    flex: none;
    background: linear-gradient(135deg, #1DB954, #0b6b33);
    color: #000;
}
.dock-art .icon { width: 22px; height: 22px; }

.dock-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
#dockTitle {
    font-size: 0.86rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#dockMeta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dock-center { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; width: 100%; }

#dock-transport { display: flex; align-items: center; gap: 18px; }

.dock-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    transition: color 150ms var(--ease), transform 150ms var(--ease);
}
.dock-btn .icon { width: 18px; height: 18px; }
.dock-btn:hover { color: #fff; border: 0; background: transparent; }
.dock-btn.is-active { color: var(--accent); background: transparent; border: 0; }

.dock-play-btn { width: 38px; height: 38px; background: #fff; color: #000; border: 0; }
.dock-play-btn .icon { width: 16px; height: 16px; }
.dock-play-btn:hover { background: #fff; color: #000; transform: scale(1.06); }

#dock-timeline { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 560px; min-width: 0; }
.dock-time {
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: center;
}

#dockProgress {
    -webkit-appearance: auto;
    appearance: auto;
    flex: 1;
    height: 4px;
    min-width: 0;
    border-radius: 2px;
    background: #4d4d4d;
    accent-color: #fff;
    outline: none;
}
#dockProgress::-webkit-slider-thumb { -webkit-appearance: auto; width: auto; height: auto; border-radius: 0; background: initial; box-shadow: none; }

/* 5-channel fader rack */
#dock-faders { display: flex; align-items: flex-end; justify-content: flex-end; gap: 0; min-width: 0; }

.dock-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 2px 5px;
    border: 0;
    border-radius: 6px;
}
.dock-channel:hover { background: transparent; border: 0; }
.dock-channel.is-missing { opacity: 0.35; }
.dock-channel.is-missing .dock-fader { opacity: 0.4; }

.dock-channel-value {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.dock-fader {
    -webkit-appearance: auto;
    appearance: auto;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 16px;
    height: 46px;
    accent-color: var(--accent);
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: none;
    cursor: pointer;
}
.dock-fader:hover { box-shadow: none; }

.dock-channel-label {
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Slim trace bar while the dock is hidden */
#dock-peek {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 39;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: #181818;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
}
html.dock-hidden #dock-peek { display: flex; }

.peek-art {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: linear-gradient(135deg, #1DB954, #0b6b33);
    color: #000;
    display: grid;
    place-items: center;
    flex: none;
}
.peek-art .icon { width: 16px; height: 16px; }
.peek-title {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.peek-btn, .peek-play {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
}
.peek-btn .icon { width: 16px; height: 16px; }
.peek-btn:hover { color: #fff; border: 0; }
.peek-play { width: 38px; height: 38px; background: #fff; color: #000; box-shadow: none; }
.peek-play .icon { width: 15px; height: 15px; }
.peek-play:hover { background: #fff; }

/* ---- Admin suite ---- */
.admin-panel { max-width: none; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.admin-tab {
    padding: 6px 14px;
    border-radius: 999px;
    background: #242424;
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.admin-tab:hover { background: #2e2e2e; color: #fff; border-color: transparent; text-decoration: none; }
.admin-tab.is-active { background: #fff; color: #000; border-color: #fff; }

.panel-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.panel-title { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.03em; color: #fff; }
.panel-count { font-size: 0.8rem; color: var(--text-secondary); }

.admin-section { margin-top: 22px; }

.table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: auto; background: #181818; }
.roster-table th {
    background: #1f1f1f;
    color: var(--text-secondary);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.roster-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.roster-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

.upcoming-card { background: #181818; border: 0; border-left: 2px solid var(--accent); border-radius: 8px; padding: 10px 14px; }
.upcoming-card li { background: #121212; }
.upcoming-notes { color: var(--warning); }

.ai-card { background: #181818; border: 1px solid var(--border); border-radius: 10px; }
.modal-card { background: #181818; border: 1px solid var(--border); }
.modal-backdrop { background: rgba(0, 0, 0, 0.75); }

/* ---- Flash ---- */
.flash-bar { max-width: none; margin: 14px 0 0; border-radius: 8px; }
.flash-success { background: rgba(29, 185, 84, 0.14);  border: 1px solid rgba(29, 185, 84, 0.35);  color: #1ed760; }
.flash-info    { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);            color: #fff; }
.flash-warning { background: rgba(255, 164, 43, 0.12); border: 1px solid rgba(255, 164, 43, 0.3);   color: #ffa42b; }
.flash-danger  { background: rgba(241, 94, 108, 0.12); border: 1px solid rgba(241, 94, 108, 0.32);  color: #f15e6c; }

/* ---- Fullscreen viewer ---- */
#fullscreen-view { background: #000; }
.fullscreen-close:hover { background: #fff; color: #000; border-color: #fff; }

/* ---- Responsive ---- */
@media (max-width: 1180px) {
    .song-card { grid-template-columns: 24px 44px minmax(0, 1fr) minmax(0, 1fr) 84px 32px; }
    #studio-dock { grid-template-columns: minmax(150px, 1fr) minmax(260px, 1.6fr) minmax(190px, 0.9fr); gap: 10px; }
    .schedule-songs { display: none; }
}

@media (max-width: 1100px) {
    :root { --dock-h: 150px; }
    #studio-dock {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "info faders"
            "center center";
        row-gap: 8px;
        padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
    }
    #dock-track-info { grid-area: info; }
    #dock-faders { grid-area: faders; }
    .dock-center { grid-area: center; }
    .dock-art { width: 42px; height: 42px; }
    .dock-fader { height: 34px; }
    .dock-channel-value { display: none; }
}

@media (max-width: 900px) {
    :root { --sidebar-w: 0px; --header-h: 58px; --dock-h: 150px; }

    #app-shell.is-auth {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 0 0 var(--dock-h);
    }

    #app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: var(--dock-h);
        width: 282px;
        z-index: 60;
        background: #000;
        padding: 8px 8px 8px 0;
        transform: translateX(-100%);
        transition: transform 240ms var(--ease);
        overflow: hidden;
        display: flex;
    }
    html.sidebar-open #app-sidebar { transform: none; }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(0, 0, 0, 0.6);
        display: block;
    }
    .sidebar-scrim[hidden] { display: none; }

    .sidebar-toggle { display: grid; }

    #app-view { border-radius: 0; height: 100%; }
    .app-header-row { padding: 0 12px; gap: 10px; }
    .history-btns { display: none; }

    /* Compact mixer rows so the 5 faders + transport fit the dock. */
    #studio-dock { row-gap: 6px; }
    .dock-center { gap: 4px; }
    #dock-transport { gap: 14px; }
    .dock-play-btn { width: 36px; height: 36px; }
    .dock-fader { height: 30px; }
    .dock-channel { gap: 2px; padding: 2px 4px; }

    #main-content { padding: 0 14px 32px; }

    .page-hero { margin: 0 -14px; padding: 20px 14px 18px; gap: 16px; }
    .page-hero-art { width: 96px; }
    .page-title { font-size: clamp(1.6rem, 7vw, 2.4rem); }

    .song-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
    .song-index, .song-card-badges, .song-target-date { display: none; }
    .song-main { flex: 1; }
    .song-cta { opacity: 1; transform: none; }

    .split-head { margin: 0 -14px 14px; padding: 20px 14px 16px; }
    .split-title-wrap { gap: 14px; }
    .sheet-art { width: 84px; }
    .split-body { grid-template-columns: 1fr; height: auto; min-height: 0; }
    .split-lyrics { max-height: 42dvh; }
    .split-score { height: 52dvh; }

    .filter-toolbar .search-input { flex: 1 1 100%; }
    .filter-select { flex: 1 1 140px; }
    .offline-playlist-actions { margin-left: 0; }
    .logout-link { padding: 6px 10px; }
}

@media (max-width: 620px) {
    .schedule-bar { max-width: 100%; flex: 1; }
    .schedule-label { display: none; }
    .notif-bell { display: none; }
    .song-group-title { font-size: 1.2rem; }
    .page-actions { gap: 10px; }
    .repertoire-tab { padding: 5px 11px; font-size: 0.78rem; }
    .offline-playlist-bar { align-items: flex-start; }
    .app-logo-text { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
    #app-sidebar { transition: none; }
    .song-card, .song-cta, .btn, .icon-btn { transition: none; }
}
