:root {
    color-scheme: light;
    --ink: #242722;
    --muted: #6d7169;
    --paper: #f5f4ef;
    --surface: #fffefa;
    --line: #e4e2d9;
    --green: #315d49;
    --green-dark: #244735;
    --green-soft: #e7efe8;
    --red: #a93636;
    --red-soft: #fff0ee;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
}

button,
input {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    min-height: 72px;
    padding: 0 max(24px, calc((100vw - 1120px) / 2));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--green);
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -.03em;
    text-decoration: none;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    flex: 1;
}

.topbar nav a {
    color: var(--muted);
    font-size: .92rem;
    font-weight: 650;
    text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
    color: var(--green);
}

.topbar form {
    margin: 0;
}

.current-user {
    color: var(--ink);
    font-size: .88rem;
    font-weight: 750;
    white-space: nowrap;
}

.page {
    width: min(100% - 40px, 960px);
    margin: 48px auto 80px;
}

.page-heading,
.section-heading,
.dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-heading {
    margin-bottom: 28px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 5vw, 2.8rem);
    letter-spacing: -.055em;
}

h2 {
    margin-bottom: 18px;
    font-size: 1.15rem;
    letter-spacing: -.02em;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--green);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.muted,
.field-hint {
    color: var(--muted);
}

.page-heading .muted {
    margin-bottom: 0;
}

.panel {
    margin-top: 18px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 5px 20px rgb(34 38 31 / 3%);
}

.add-form,
.dialog-form {
    display: grid;
    gap: 14px;
}

.song-row,
.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dialog-form label,
.stack label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.dialog-form input,
.stack input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgb(49 93 73 / 24%);
    outline-offset: 2px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.button-primary {
    background: var(--green);
    color: #fff;
}

.button-primary:hover {
    background: var(--green-dark);
}

.button-secondary {
    border-color: #d8e2d8;
    background: var(--green-soft);
    color: var(--green-dark);
}

.button-secondary:hover {
    background: #dce9dd;
}

.button-danger {
    background: var(--red);
    color: #fff;
}

.button-danger:hover {
    background: #8f2e2e;
}

.button-quiet {
    background: transparent;
    color: var(--muted);
}

.button-quiet:hover {
    background: var(--paper);
    color: var(--ink);
}

.button-full {
    width: 100%;
}

.database-import-form .button {
    justify-self: start;
}

.button-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-height: 48px;
    margin: 16px auto 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #3b8b59;
    color: #fff;
    box-shadow: 0 4px 12px rgb(49 93 73 / 20%);
}

.add-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
}

.add-icon::before,
.add-icon::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    content: "";
    transform: translate(-50%, -50%);
}

.add-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.button-add:hover {
    background: #2e7348;
}

.vote-button-needed {
    border-color: #f0aa28;
    background: #ffd166;
    color: #4c3100;
    animation: vote-attention 1.6s ease-in-out infinite;
}

.vote-button-needed:hover {
    border-color: #dc8d00;
    background: #ffc247;
    color: #3d2700;
}

@keyframes vote-attention {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgb(237 157 24 / 48%);
    }
    50% {
        box-shadow: 0 0 0 7px rgb(237 157 24 / 0%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vote-button-needed {
        animation: none;
    }
}

.icon-button {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .08em;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--line);
    background: var(--paper);
    color: var(--ink);
}

.icon-delete,
.icon-delete:hover {
    color: var(--red);
}

.icon-delete:hover {
    border-color: #efc7c2;
    background: var(--red-soft);
}

.icon-delete svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.row-actions,
.row-actions form {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.entry-title {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.edit-dialog {
    width: min(440px, calc(100% - 32px));
    max-height: min(85vh, 760px);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    box-shadow: 0 20px 80px rgb(0 0 0 / 22%);
}

.edit-dialog::backdrop {
    background: rgb(25 30 25 / 55%);
}

.edit-dialog .dialog-heading {
    margin-bottom: 20px;
}

.edit-dialog .dialog-heading h2 {
    margin: 0;
}

.edit-dialog .dialog-form {
    margin: 0;
}

.edit-dialog .dialog-form .button {
    justify-self: end;
    margin-top: 4px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.section-heading {
    margin-bottom: 16px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.count {
    display: inline-grid;
    min-width: 28px;
    min-height: 28px;
    place-items: center;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: .8rem;
    font-weight: 800;
}

.count-inline {
    min-width: 24px;
    min-height: 24px;
    background: rgb(255 255 255 / 20%);
    color: inherit;
}

.song-list,
.member-list,
.wish-list {
    display: grid;
    gap: 8px;
}

.song-row,
.member-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.project-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(145px, auto);
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.project-row.project-complete {
    border: 1px solid #b9d7c0;
    background: #e9f5ec;
}

.project-complete .entry-title strong,
.project-complete .progress-count {
    color: #22603a;
}

.project-edit {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.progress-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 10px;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .82rem;
    white-space: nowrap;
    cursor: pointer;
}

.check-label input {
    width: 17px;
    height: 17px;
    accent-color: var(--green);
}

.progress-count {
    border-bottom: 1px dotted var(--muted);
    color: var(--green-dark);
    font-weight: 800;
    cursor: help;
}

.wish-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 165px 170px 76px;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.wish-veto .entry-title strong,
.wish-veto .entry-title .muted {
    color: #a91624;
    text-decoration: line-through;
    text-decoration-color: #c21f30;
    text-decoration-thickness: 2px;
}

.rank {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: var(--paper);
    color: var(--muted);
    font-weight: 800;
}

.vote-counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 165px;
    color: var(--muted);
    font-size: .83rem;
    font-weight: 750;
    white-space: nowrap;
}

.vote-counts > span {
    text-align: center;
}

.wish-row > .current-vote,
.wish-row > .badge {
    width: 100%;
    justify-self: stretch;
    text-align: center;
}

.wish-row > .current-vote {
    justify-content: center;
}

.wish-row > .badge {
    padding-right: 4px;
    padding-left: 4px;
}

.wish-row > .row-actions {
    justify-content: flex-end;
}

.vote-like {
    color: var(--green-dark);
}

.vote-veto {
    color: var(--red);
}

.wish-veto .vote-veto {
    padding: 4px 8px;
    border-radius: 999px;
    background: #a91624;
    color: #fff;
}

.current-vote {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #cbdccd;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: .76rem;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}

.current-vote:hover {
    border-color: var(--green);
}

.current-vote-veto {
    border-color: #b21f2d;
    background: #a91624;
    color: #fff;
}

.empty-state {
    margin: 0;
    padding: 24px 12px;
    color: var(--muted);
    text-align: center;
}

.audit-month-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.audit-month-form label {
    font-weight: 700;
}

.audit-month-form select {
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.audit-entries {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 2rem;
}

.audit-entries li {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .82rem;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .audit-month-form {
        align-items: stretch;
        flex-direction: column;
    }
}

.member-readonly {
    display: flex;
    align-items: center;
    min-height: 58px;
    font-weight: 700;
}

.notice {
    margin: 12px 0;
    padding: 12px 15px;
    border: 1px solid #c9dfca;
    border-radius: 9px;
    background: var(--green-soft);
    color: var(--green-dark);
}

.notice-error {
    border-color: #efc7c2;
    background: var(--red-soft);
    color: var(--red);
}

.vote-dialog {
    width: min(760px, calc(100% - 32px));
    max-height: min(85vh, 800px);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    box-shadow: 0 20px 80px rgb(0 0 0 / 22%);
}

.vote-dialog::backdrop {
    background: rgb(25 30 25 / 55%);
}

.dialog-heading h2 {
    margin-bottom: 0;
}

.dialog-wishes {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.batch-vote-form {
    display: grid;
    gap: 12px;
}

.batch-vote-form > .button {
    justify-self: end;
    margin-top: 4px;
}

.dialog-wish {
    display: grid;
    grid-template-columns: minmax(120px, .75fr) minmax(0, 1.5fr);
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.vote-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
}

.dialog-wish > div:first-child {
    display: grid;
    gap: 4px;
}

.badge {
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    background: #fff0cf;
    color: #775209;
    font-size: .7rem;
    font-weight: 800;
}

.vote-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.vote-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: .8rem;
    cursor: pointer;
}

.vote-option input {
    accent-color: var(--green);
}

.vote-option-large {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .9rem;
}

.edit-dialog .dialog-form .vote-option {
    display: flex;
    align-items: center;
    justify-self: stretch;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.2;
}

.edit-dialog .dialog-form .vote-option input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    min-height: 0;
    margin: 0;
}

.vote-form .button {
    margin-left: auto;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgb(215 229 214 / 70%), transparent 34%),
        var(--paper);
}

.login-card {
    width: min(100%, 420px);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 18px 60px rgb(34 38 31 / 8%);
}

.login-card h1 {
    margin-bottom: 8px;
    color: var(--green);
}

.error-card h1 {
    font-size: 2rem;
}

.error-status {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.stack {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.field-hint {
    margin: -3px 0 8px;
    font-size: .78rem;
    line-height: 1.5;
}

.sr-only {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

@media (max-width: 760px) {
    .topbar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 16px;
        padding: 14px 20px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    .brand,
    .topbar form {
        flex: 0 0 auto;
    }

    .topbar nav {
        flex: 0 0 auto;
        gap: 16px;
    }

    .current-user {
        flex: 0 0 auto;
    }

    .topbar nav a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .page {
        width: min(100% - 28px, 960px);
        margin-top: 28px;
    }

    .panel {
        padding: 18px;
    }

    .add-form {
        grid-template-columns: 1fr;
    }

    .song-row,
    .member-row {
        align-items: flex-start;
    }

    .project-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
    }

    .project-edit {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .progress-cell {
        justify-content: flex-start;
    }

    .wish-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
    }

    .wish-row > .rank {
        grid-column: 1;
        grid-row: 1;
    }

    .wish-row > .entry-title {
        grid-column: 2;
        grid-row: 1;
    }

    .vote-counts {
        grid-column: 2 / -1;
        grid-row: 2;
        width: min(100%, 165px);
    }

    .wish-row .row-actions {
        grid-column: 3;
        grid-row: 1;
    }

    .wish-row > .current-vote,
    .wish-row > .badge {
        grid-column: 2 / -1;
        grid-row: 3;
        width: fit-content;
        justify-self: start;
    }

    .dialog-wish {
        grid-template-columns: 1fr;
    }

    .vote-form .button {
        margin-left: 0;
    }

    .page-heading {
        align-items: flex-start;
    }
}

@media (max-width: 440px) {
    .page-heading {
        flex-direction: column;
    }

    .section-heading {
        align-items: flex-start;
    }

    .vote-form {
        align-items: flex-start;
    }

    .login-card {
        padding: 26px 22px;
    }
}
