:root {
    color-scheme: light;
    font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
    color: #20251f;
    background: #f4f5ef;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: #3f673e;
    font-weight: 700;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background: radial-gradient(circle at top left, #dfead8, transparent 42%), #f4f5ef;
}

.auth-card {
    width: min(100%, 480px);
    padding: 40px;
    background: #fff;
    border: 1px solid #dde1d7;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgb(52 65 48 / 10%);
}

.eyebrow {
    margin: 0 0 12px;
    color: #588056;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.14;
    letter-spacing: -0.04em;
}

.auth-card h1 {
    font-size: 2rem;
}

.description {
    color: #62695f;
    line-height: 1.65;
}

form {
    display: grid;
    gap: 10px;
}

label {
    margin-top: 10px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #c9cec3;
    border-radius: 10px;
    background: #fff;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #dbe8d5;
    border-color: #588056;
}

button {
    margin-top: 16px;
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: #3f673e;
    font-weight: 800;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 13px 18px;
    border-radius: 10px;
    color: #fff;
    background: #3f673e;
    text-decoration: none;
}

.secondary-link {
    color: #3f673e;
    background: #edf3ea;
}

.field-hint,
.field-error {
    margin: -3px 0 0;
    font-size: 0.86rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.field-hint {
    color: #747b70;
}

.field-error,
.notice.error {
    color: #ad3328;
}

.auth-link {
    margin: 24px 0 0;
    text-align: center;
}

.notice {
    padding: 12px 14px;
    border-radius: 10px;
}

.notice.success {
    color: #315d35;
    background: #e8f2e5;
}

.notice.error {
    background: #fbe9e7;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px max(24px, calc((100vw - 1100px) / 2));
    border-bottom: 1px solid #dde1d7;
    background: #fff;
}

.topbar form {
    display: block;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topnav > a {
    text-decoration: none;
}

.brand {
    color: #20251f;
    text-decoration: none;
}

.secondary-button {
    margin: 0;
    padding: 9px 13px;
    color: #3f673e;
    background: #edf3ea;
}

.page-shell {
    width: min(1100px, calc(100% - 40px));
    margin: 72px auto;
}

.narrow-page {
    width: min(900px, calc(100% - 40px));
}

.page-heading,
.section-heading,
.song-row-heading,
.setlist-card-topline,
.detail-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.setlist-form {
    margin-top: 44px;
    gap: 24px;
}

.form-section,
.detail-section {
    padding: 30px;
    border: 1px solid #dde1d7;
    border-radius: 20px;
    background: #fff;
}

.form-section h2,
.detail-section h2 {
    margin: 0 0 18px;
}

.section-heading h2 {
    margin-bottom: 4px;
}

.section-heading p,
.section-description {
    margin: 0 0 18px;
    color: #747b70;
}

.form-grid,
.song-fields {
    display: grid;
    gap: 18px;
}

.two-columns,
.song-fields {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.35fr);
}

.form-grid > div,
.song-fields > div {
    display: grid;
    gap: 8px;
}

.full-column {
    grid-column: 1 / -1;
}

.song-rows {
    display: grid;
    gap: 10px;
}

.song-row {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e1e5dc;
    border-radius: 14px;
    background: #fafbf8;
}

.song-row-heading {
    align-self: center;
    justify-content: center;
}

.song-number {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    color: #3f673e;
    background: #e8f0e4;
    font-weight: 800;
}

.song-fields {
    grid-template-columns: minmax(230px, 2fr) minmax(82px, 0.45fr) minmax(180px, 1.25fr);
    gap: 12px;
    align-items: start;
}

.song-fields label {
    margin-top: 0;
    font-size: 0.88rem;
}

.song-title-field {
    position: relative;
}

.song-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #c9cec3;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 30px rgb(52 65 48 / 16%);
}

.song-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    color: #20251f;
    background: transparent;
    text-align: left;
}

.song-suggestion[hidden] {
    display: none;
}

.song-suggestion:hover,
.song-suggestion:focus {
    outline: none;
    background: #edf3ea;
}

.suggestion-key {
    min-width: 30px;
    padding: 4px 7px;
    border-radius: 7px;
    color: #fff;
    background: #588056;
    font-size: 0.8rem;
    text-align: center;
}

.song-empty-option {
    margin: 0;
    padding: 10px 12px;
    color: #747b70;
    font-size: 0.86rem;
}

.song-row > .remove-song {
    align-self: end;
    margin-bottom: 7px;
}

.text-button {
    margin: 0;
    padding: 6px 8px;
    color: #8d3b32;
    background: transparent;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.form-actions button {
    margin: 0;
}

.setlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 44px;
}

.catalog-search {
    display: grid;
    gap: 18px;
    margin-top: 38px;
    padding: 24px;
    border: 1px solid #dde1d7;
    border-radius: 18px;
    background: #fff;
}

.catalog-search button {
    margin: 0;
}

.advanced-search-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.advanced-search-grid > div {
    display: grid;
    gap: 8px;
}

.search-text-field {
    grid-column: span 3;
}

.search-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.search-summary {
    color: #697064;
}

.song-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.song-card {
    padding: 24px;
    border: 1px solid #dde1d7;
    border-radius: 18px;
    background: #fff;
}

.song-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.song-card-heading h2 {
    display: inline;
    margin: 0 8px 0 0;
}

.light-key {
    color: #3f673e;
    background: #e9f0e5;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 20px;
}

.tag-list span {
    padding: 6px 9px;
    border-radius: 999px;
    color: #4d654a;
    background: #f0f4ed;
    font-size: 0.86rem;
}

.song-notes {
    margin: 18px 0 0;
    color: #697064;
    line-height: 1.6;
    white-space: pre-wrap;
}

.usage-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
    padding: 14px;
    border-radius: 12px;
    background: #e9f0e5;
}

.usage-summary > div {
    display: grid;
    gap: 4px;
}

.usage-summary span {
    color: #697064;
    font-size: 0.8rem;
}

.usage-summary.unused {
    display: block;
    color: #747b70;
    background: #f1f2ef;
}

.usage-summary p {
    margin: 0;
}

.usage-history {
    margin-top: 16px;
}

.usage-history summary {
    color: #3f673e;
    font-weight: 800;
    cursor: pointer;
}

.usage-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.usage-list a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e1e5dc;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

.usage-list a:hover {
    border-color: #9db297;
    background: #fafbf8;
}

.usage-list time {
    color: #697064;
    font-size: 0.86rem;
}

.usage-context {
    display: grid;
    gap: 3px;
}

.usage-context small {
    color: #747b70;
}

.setlist-card {
    padding: 24px;
    border: 1px solid #dde1d7;
    border-radius: 18px;
    color: inherit;
    background: #fff;
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.setlist-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgb(52 65 48 / 10%);
}

.setlist-card-topline {
    color: #697064;
    font-size: 0.9rem;
}

.setlist-card h2 {
    margin: 28px 0 6px;
}

.church-name,
.setlist-theme {
    margin: 0;
}

.setlist-theme {
    margin-top: 20px;
    color: #4d654a;
}

.back-link {
    display: inline-block;
    margin-bottom: 26px;
    text-decoration: none;
}

.detail-date {
    color: #697064;
    font-size: 1.05rem;
}

.detail-metadata {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 38px 0 18px;
}

.detail-metadata > div {
    display: grid;
    gap: 8px;
    padding: 22px;
    border-radius: 16px;
    background: #e9f0e5;
}

.detail-metadata span {
    color: #697064;
    font-size: 0.86rem;
}

.detail-section {
    margin-top: 18px;
}

.setlist-items {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.setlist-items li {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 18px 4px;
    border-bottom: 1px solid #ecefe8;
}

.setlist-items li:last-child {
    border-bottom: 0;
}

.position {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    color: #3f673e;
    background: #e9f0e5;
    font-weight: 800;
}

.setlist-items p {
    margin: 6px 0 0;
    color: #747b70;
}

.key-badge {
    padding: 7px 11px;
    border-radius: 9px;
    color: #fff;
    background: #3f673e;
    font-weight: 800;
}

.reference-list {
    display: grid;
    gap: 10px;
}

.reference-list a {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 14px;
    border-radius: 10px;
    background: #f1f4ee;
    text-decoration: none;
}

.preserve-lines {
    white-space: pre-wrap;
}

.empty-state {
    margin-top: 48px;
    padding: 36px;
    border: 1px dashed #aeb8a8;
    border-radius: 20px;
    background: #fff;
}

@media (max-width: 520px) {
    .auth-card {
        padding: 28px 22px;
        border-radius: 18px;
    }

    .page-heading,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .two-columns,
    .song-fields,
    .detail-metadata {
        grid-template-columns: 1fr;
    }

    .song-row {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        align-items: start;
        padding: 14px;
    }

    .song-row-heading,
    .song-row > .remove-song {
        margin-top: 30px;
    }

    .song-row > .remove-song {
        margin-bottom: 0;
    }

    .advanced-search-grid {
        grid-template-columns: 1fr;
    }

    .search-text-field {
        grid-column: auto;
    }

    .search-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .usage-list a {
        grid-template-columns: 1fr auto;
    }

    .usage-list time {
        grid-column: 1 / -1;
    }

    .full-column {
        grid-column: auto;
    }

    .form-section,
    .detail-section {
        padding: 22px;
    }
}
