:root {
    --hp-navy: #102a43;
    --hp-navy-deep: #0a1f33;
    --hp-blue: #23658c;
    --hp-gold: #f1cf78;
    --hp-gold-dark: #d29f3e;
    --hp-ink: #17212b;
    --hp-muted: #66788a;
    --hp-canvas: #f4f7fa;
    --hp-card: #ffffff;
    --hp-border: #dbe4ec;
    --hp-success: #25735b;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--hp-ink);
    background: var(--hp-canvas);
    font-size: 1rem;
    line-height: 1.55;
}

main {
    flex: 1;
}

.app-navbar {
    background: var(--hp-navy);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 8px 24px rgba(10, 31, 51, .12);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    color: var(--hp-navy-deep);
    background: var(--hp-gold);
    border-radius: .55rem;
}

.brand-plus {
    color: var(--hp-gold);
}

.user-menu .dropdown-toggle {
    padding: .4rem .65rem;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .88);
}

.user-menu .dropdown-toggle:hover,
.user-menu .dropdown-toggle:focus,
.user-menu .dropdown-toggle[aria-expanded="true"] {
    color: #fff;
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    color: var(--hp-navy-deep);
    background: var(--hp-gold);
    border-radius: 50%;
    font-size: .82rem;
}

.user-menu-name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu .dropdown-menu {
    min-width: 13rem;
    padding: .5rem;
    border-radius: .85rem;
}

.user-menu .dropdown-item {
    padding: .65rem .75rem;
    border-radius: .55rem;
}

.user-menu .dropdown-item:active {
    background: var(--hp-blue);
}

.btn-brand {
    --bs-btn-color: #132436;
    --bs-btn-bg: var(--hp-gold);
    --bs-btn-border-color: var(--hp-gold);
    --bs-btn-hover-color: #132436;
    --bs-btn-hover-bg: #e7bd5f;
    --bs-btn-hover-border-color: #e7bd5f;
    --bs-btn-active-bg: #dca846;
    --bs-btn-active-border-color: #dca846;
    font-weight: 700;
}

.btn-primary {
    --bs-btn-bg: var(--hp-blue);
    --bs-btn-border-color: var(--hp-blue);
    --bs-btn-hover-bg: #1a5276;
    --bs-btn-hover-border-color: #1a5276;
}

.btn-publish {
    --bs-btn-color: #102a43;
    --bs-btn-bg: #8fd3ef;
    --bs-btn-border-color: #8fd3ef;
    --bs-btn-hover-color: #102a43;
    --bs-btn-hover-bg: #73c4e6;
    --bs-btn-hover-border-color: #73c4e6;
    --bs-btn-active-color: #102a43;
    --bs-btn-active-bg: #5bb6dc;
    --bs-btn-active-border-color: #5bb6dc;
    --bs-btn-disabled-color: #496274;
    --bs-btn-disabled-bg: #c7e6f2;
    --bs-btn-disabled-border-color: #c7e6f2;
    font-weight: 700;
}

.workspace-header {
    padding: 2rem 0 1.25rem;
}

.workspace-header h1,
.auth-title,
.hero-title {
    color: var(--hp-navy-deep);
    font-weight: 800;
    letter-spacing: -.035em;
}

.workspace-kicker {
    margin-bottom: .35rem;
    color: var(--hp-blue);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.card {
    border-color: var(--hp-border);
    border-radius: 1rem;
}

.tool-card {
    background: var(--hp-card);
    box-shadow: 0 14px 40px rgba(16, 42, 67, .07);
}

.hero-shell {
    padding: clamp(3rem, 8vw, 6.5rem) 0;
}

.hero-title {
    max-width: 12ch;
    font-size: clamp(2.4rem, 7vw, 4.8rem);
    line-height: .98;
}

.hero-copy {
    max-width: 37rem;
    color: var(--hp-muted);
    font-size: 1.1rem;
}

.workflow-panel {
    overflow: hidden;
    border: 1px solid var(--hp-border);
    border-radius: 1.25rem;
    background: white;
    box-shadow: 0 24px 70px rgba(16, 42, 67, .12);
}

.workflow-panel::before {
    content: '';
    display: block;
    height: .4rem;
    background: linear-gradient(90deg, var(--hp-gold), var(--hp-blue));
}

.workflow-step {
    display: grid;
    grid-template-columns: 2.7rem 1fr;
    gap: 1rem;
    padding: 1.25rem;
}

.workflow-step + .workflow-step {
    border-top: 1px solid var(--hp-border);
}

.step-number {
    width: 2.7rem;
    height: 2.7rem;
    display: grid;
    place-items: center;
    color: var(--hp-navy);
    background: #f7e8c8;
    border-radius: .8rem;
    font-weight: 800;
}

.auth-shell {
    width: min(100% - 2rem, 31rem);
    margin: clamp(2.5rem, 8vw, 5rem) auto;
}

.auth-card {
    padding: clamp(1.35rem, 5vw, 2.25rem);
    background: white;
    box-shadow: 0 18px 55px rgba(16, 42, 67, .1);
}

.form-label {
    color: #30475b;
    font-weight: 700;
}

.form-control,
.form-select {
    min-height: 2.9rem;
    border-color: #c9d6e2;
    border-radius: .7rem;
}

textarea.form-control {
    min-height: 8rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hp-blue);
    box-shadow: 0 0 0 .22rem rgba(35, 101, 140, .14);
}

.hymnal-card {
    display: grid;
    grid-template-columns: minmax(8.5rem, 2fr) minmax(0, 3fr);
    height: 100%;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.hymnal-card .card-body {
    min-width: 0;
    height: 100%;
}

.hymnal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(16, 42, 67, .1);
}

.hymnal-cover {
    aspect-ratio: 3 / 5;
    display: grid;
    place-items: center;
    color: #6e7f90;
    background: linear-gradient(145deg, #e6edf4, #f8fafc);
    overflow: hidden;
}

.hymnal-cover img,
.cover-preview img {
    width: 100%;
    height: 100%;
}

.hymnal-cover img {
    object-fit: contain;
}

.cover-preview img {
    object-fit: cover;
}

.hymnal-cover i {
    font-size: 2.25rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}

.status-draft {
    color: #66501d;
    background: #fff1c9;
}

.status-published {
    color: #14533f;
    background: #d9f3e9;
}

.status-unpublished {
    color: #6b3440;
    background: #f8dfe4;
}

.status-pending {
    color: #75401d;
    background: #ffe5d3;
}

.meta-row {
    color: var(--hp-muted);
    font-size: .9rem;
}

.hymnal-pending-notice {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    padding: .55rem .65rem;
    border: 1px solid #efc779;
    border-radius: .65rem;
    color: #70451d;
    background: #ffedc9;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.35;
}

.hymnal-pending-notice i {
    margin-top: .12rem;
}

.empty-state {
    padding: clamp(2.5rem, 8vw, 5rem) 1.5rem;
    text-align: center;
}

.empty-icon {
    width: 4rem;
    height: 4rem;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    color: var(--hp-blue);
    background: #e1eff7;
    border-radius: 1.2rem;
    font-size: 1.65rem;
}

.cover-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--hp-muted);
    background: #eaf0f5;
    border: 1px dashed #aebdca;
    border-radius: .9rem;
}

.cover-preview-image {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.cover-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-editor {
    width: min(100%, 300px);
    margin-inline: auto;
    aspect-ratio: 3 / 5;
}

.cover-actions {
    position: absolute;
    right: .75rem;
    bottom: .75rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.cover-action-button {
    margin: 0;
    border: 1px solid rgba(16, 42, 67, .16);
    box-shadow: 0 5px 18px rgba(10, 31, 51, .24);
    font-weight: 700;
    cursor: pointer;
}

.cover-uploading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    color: #fff;
    background: rgba(10, 31, 51, .78);
    font-weight: 700;
}

.song-row {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.song-filter {
    max-width: 28rem;
}

.song-filter .input-group-text {
    color: var(--hp-muted);
    background: #f7f9fb;
}

.song-row + .song-row {
    border-top: 1px solid var(--hp-border);
}

.song-number {
    color: var(--hp-blue);
    font-size: 1.1rem;
    font-weight: 800;
}

.song-title-link {
    color: var(--hp-navy-deep);
    font-weight: 700;
    text-decoration: none;
}

.song-title-link:hover,
.song-title-link:focus-visible {
    color: var(--hp-blue);
    text-decoration: underline;
}

.sticky-tools {
    position: sticky;
    top: 5.25rem;
}

.hymnal-tabs {
    overflow-x: auto;
    scrollbar-width: none;
}

.hymnal-tabs::-webkit-scrollbar {
    display: none;
}

.hymnal-tabs .nav-tabs {
    width: max-content;
    min-width: 100%;
    gap: .2rem;
    border-bottom-color: var(--hp-border);
}

.hymnal-tabs .nav-link {
    padding: .7rem .9rem;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: .65rem .65rem 0 0;
    color: var(--hp-muted);
    font-size: .86rem;
    font-weight: 700;
    white-space: nowrap;
}

.hymnal-tabs a.nav-link:hover,
.hymnal-tabs a.nav-link:focus-visible {
    color: var(--hp-blue);
    background: rgba(35, 101, 140, .07);
}

.hymnal-tabs .nav-link.active {
    border-bottom-color: var(--hp-gold);
    color: var(--hp-navy-deep);
    background: #fff;
}

.hymnal-tabs .nav-link.disabled {
    color: #a7b2bd;
    opacity: .72;
}

.publication-card {
    overflow: hidden;
}

.publication-change-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .4rem;
    padding: .38rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.publication-change-badge i {
    font-size: .55rem;
}

.publication-change-badge.has-changes {
    color: #70451d;
    background: #fff0cf;
}

.publication-change-badge.is-current {
    color: #14533f;
    background: #d9f3e9;
}

.publication-change-badge.is-current i {
    font-size: .72rem;
}

.publication-change-badge.is-draft {
    color: #51687a;
    background: #e8eff4;
}

.publication-visibility {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem;
    border: 1px solid;
    border-radius: .9rem;
    transition: opacity .18s ease, background-color .18s ease, border-color .18s ease;
}

.publication-visibility > .flex-grow-1 {
    min-width: 0;
}

.publication-visibility.is-published {
    border-color: #b9dfd1;
    background: #eff8f5;
}

.publication-visibility.is-unpublished {
    border-color: #ead4d9;
    background: #fcf4f6;
}

.publication-visibility.is-saving {
    opacity: .58;
}

.publication-state-icon {
    width: 2.45rem;
    height: 2.45rem;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: .75rem;
}

.is-published .publication-state-icon {
    color: #14533f;
    background: #d3eee4;
}

.is-unpublished .publication-state-icon {
    color: #783b49;
    background: #f4dce2;
}

.publication-state-copy {
    display: block;
    color: var(--hp-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.publication-switch .form-check {
    min-height: auto;
    padding-left: 0;
}

.publication-switch .form-check-input {
    width: 2.8rem;
    height: 1.5rem;
    float: none;
    margin: 0;
    cursor: pointer;
}

.publication-switch .form-check-input:checked {
    border-color: var(--hp-success);
    background-color: var(--hp-success);
}

.publication-switch .form-check-input:disabled {
    cursor: not-allowed;
}

.publication-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
}

.publication-meta-item {
    padding: .8rem;
    border: 1px solid var(--hp-border);
    border-radius: .8rem;
    background: #f8fafc;
}

.publication-meta-item span,
.publication-meta-item strong {
    display: block;
}

.publication-meta-item span {
    margin-bottom: .15rem;
    color: var(--hp-muted);
    font-size: .75rem;
}

.publication-meta-item strong {
    color: var(--hp-navy-deep);
    font-size: 1.05rem;
}

.publication-first-step,
.publication-pending {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .8rem;
    border-radius: .8rem;
    font-size: .82rem;
    line-height: 1.4;
}

.publication-first-step {
    color: #466173;
    background: #edf4f8;
}

.publication-pending {
    color: #70451d;
    padding: 1rem 1.1rem;
    border: 1px solid #efc779;
    background: #ffedc9;
    font-size: 1rem;
    font-weight: 700;
}

.publication-pending i {
    margin-top: .1rem;
    font-size: 1.2rem;
}

.danger-zone {
    border-top: 1px solid var(--hp-border);
}

.danger-zone-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .2rem 0;
    cursor: pointer;
    list-style: none;
}

.danger-zone-summary::-webkit-details-marker {
    display: none;
}

.danger-zone-chevron {
    color: var(--hp-muted);
    transition: transform .2s ease;
}

.danger-zone[open] .danger-zone-chevron {
    transform: rotate(180deg);
}

.danger-zone-content {
    padding-top: 1rem;
}

.danger-zone-warning {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-bottom: 1rem;
    padding: .85rem;
    border: 1px solid #efc8ce;
    border-radius: .8rem;
    color: #71343e;
    background: #fff5f6;
    font-size: .82rem;
    line-height: 1.45;
}

.song-identity {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid #cfdfeb;
    border-radius: .9rem;
    background: #f3f8fb;
}

.song-identity-number {
    flex: 0 0 auto;
    min-width: 3rem;
    padding: .45rem .6rem;
    border-radius: .65rem;
    color: #fff;
    background: var(--hp-blue);
    text-align: center;
    font-weight: 800;
}

.song-identity-title {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--hp-navy-deep);
}

.song-tag-guide {
    display: grid;
    gap: .75rem;
}

.song-tag-guide-item {
    padding: .85rem;
    border-radius: .8rem;
    background: #f7f9fb;
}

.song-tag-guide-item code {
    display: inline-block;
    margin-bottom: .4rem;
    color: #9a3151;
    font-weight: 800;
}

.song-tag-guide-item p {
    margin: 0;
    color: var(--hp-muted);
    font-size: .82rem;
    line-height: 1.45;
}

.site-footer {
    padding: 1.5rem 0;
    color: #8292a2;
    font-size: .85rem;
}

@media (max-width: 767.98px) {
    .hymnal-card {
        grid-template-columns: minmax(7.5rem, 42%) minmax(0, 1fr);
    }

    .hymnal-card .card-body {
        padding: .9rem;
    }

    .hymnal-card .meta-row {
        gap: .45rem !important;
    }

    .workspace-header {
        padding-top: 1.4rem;
    }

    .sticky-tools {
        position: static;
    }

    .publication-change-badge {
        max-width: 9.5rem;
        white-space: normal;
    }

    .song-row {
        grid-template-columns: 3rem minmax(0, 1fr);
        gap: .75rem;
    }

    .song-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .5rem;
    }

    .danger-zone .btn {
        width: 100%;
    }

    .hero-shell {
        padding-top: 2.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
