.brand-mark {
    width: 50px;
    height: 54px;
    padding: 3px;
    overflow: hidden;
    border-radius: 8px;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: #edf0ed;
}

.admin-nav a {
    padding: 5px 9px;
    border-radius: 7px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 750;
    text-decoration: none;
}

.admin-nav a.active {
    background: #fff;
    color: var(--green);
    box-shadow: 0 1px 4px rgba(36, 52, 45, .12);
}

.anchored-item {
    scroll-margin-top: 20px;
}

.anchored-item:target {
    animation: anchor-highlight 1.5s ease-out;
}

@keyframes anchor-highlight {
    0%, 35% { box-shadow: 0 0 0 4px rgba(232, 149, 88, .42); }
    100% { box-shadow: none; }
}

.shift.unassigned {
    border: 2px solid #c84f45;
    border-left-width: 6px;
    background: #fff4f3;
}

.shift.unassigned .date-badge,
.shift.unassigned .available {
    color: #a83f36;
}

.shift.unassigned .available {
    background: #f8deda;
}

.shift,
.volunteer-shift {
    border-left-width: 10px;
    border-left-color: var(--shift-color);
}

.shift.assigned,
.shift.unassigned,
.volunteer-shift.is-mine,
.volunteer-shift.is-free,
.volunteer-shift.is-pending,
.volunteer-shift.is-reserve {
    border-left-width: 10px;
    border-left-color: var(--shift-color);
}

input[type="color"] {
    min-width: 52px;
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

.shift-actions {
    display: flex;
    align-items: center;
    position: relative;
}

.edit-shift {
    position: relative;
}

.edit-shift summary {
    list-style: none;
    cursor: pointer;
}

.edit-shift summary::-webkit-details-marker {
    display: none;
}

.edit-shift-form {
    position: absolute;
    z-index: 5;
    top: 38px;
    right: 0;
    width: min(360px, calc(100vw - 44px));
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.edit-shift-form h3 {
    margin: 0;
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.admin-account-box {
    align-items: flex-start;
}

.admin-password-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    align-items: end;
    gap: 10px;
    width: min(760px, 100%);
}

.profile-add-form,
.profile-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 140px 85px auto;
    align-items: end;
    gap: 10px;
}

.profile-add-form {
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 13px;
    background: #f3f5f2;
}

.profile-grid {
    display: grid;
    gap: 9px;
}

.profile-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 10px solid var(--profile-color);
    border-radius: 12px;
}

.profile-actions {
    display: flex;
    gap: 6px;
}

.profile-actions button {
    padding: .6rem .7rem;
}

.date-list-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.list-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.list-heading-row .legend {
    margin-bottom: 0;
}

.list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 8px;
}

.schedule-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-left: 12px;
    border-radius: 10px;
    background: #edf0ed;
    color: var(--muted);
}

.schedule-filter select {
    width: auto;
    min-width: 175px;
    margin: 0;
    padding: .72rem 2rem .72rem .2rem;
    border: 0;
    background-color: transparent;
    color: var(--ink);
    font-weight: 750;
    cursor: pointer;
}

.history-button {
    width: 44px;
    padding: 0;
}

.history-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-button.active {
    background: var(--green);
    color: #fff;
}

.volunteer-counts {
    display: flex;
    gap: 10px;
}

.year-count {
    position: relative;
    width: max-content;
    max-width: 100%;
    border-bottom: 1px dotted currentColor;
    color: var(--muted);
    font-size: .77rem;
    cursor: help;
    outline: none;
}

.year-count:focus-visible {
    border-radius: 3px;
    box-shadow: 0 0 0 3px rgba(47, 107, 79, .2);
}

.year-popup {
    position: absolute;
    z-index: 20;
    left: 0;
    bottom: calc(100% + 9px);
    width: min(330px, calc(100vw - 44px));
    max-height: 320px;
    padding: 15px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--ink);
    cursor: default;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: opacity .15s, transform .15s, visibility .15s;
}

.year-count:hover .year-popup,
.year-count:focus .year-popup,
.year-count:focus-within .year-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.year-popup > strong {
    display: block;
    margin-bottom: 9px;
    color: var(--green);
    font-size: .86rem;
}

.year-popup ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.year-popup li {
    display: grid;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.year-popup li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.person-card .year-popup li span,
.person-card .year-popup-empty {
    color: var(--muted);
    font-size: .72rem;
}

.year-popup li strong {
    font-size: .8rem;
}

.dates-list.hide-past .date-item.past {
    display: none;
}

.dates-list.hide-past .month-group.past-only {
    display: none;
}

.dates-list.show-unregistered-only .date-item:not(.no-registration) {
    display: none;
}

.dates-list .date-item[hidden],
.dates-list .month-group[hidden],
.dates-list [data-filter-empty][hidden] {
    display: none;
}

.month-group {
    margin-bottom: 22px;
}

.month-group:last-child {
    margin-bottom: 0;
}

.month-heading {
    margin: 0 0 9px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    color: var(--green);
    font-family: Georgia, serif;
    font-size: 1.25rem;
}

.month-items {
    display: grid;
    gap: 8px;
}

.volunteer-schedule {
    display: block;
}

.volunteer-schedule .month-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 1000px) {
    .admin-account-box {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-password-form {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
        width: 100%;
    }
}

@media (max-width: 850px) {
    .profile-add-form,
    .profile-card {
        grid-template-columns: 1fr 1fr;
    }

    .volunteer-schedule .month-items {
        grid-template-columns: 1fr;
    }
}

.candidate-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.candidate {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 99px;
    background: #edf0ed;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.candidate.selected {
    background: var(--green-soft);
    color: var(--green);
}

.candidate.reserve {
    background: #f4eef7;
    color: #765687;
}

.candidate-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.candidate-form button {
    padding: 0 2px;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
}

.candidate-form button:hover {
    background: rgba(0, 0, 0, .08);
    transform: none;
}

.admin-registration-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.admin-registration-form select {
    width: min(220px, 100%);
    margin: 0;
    padding: .48rem .6rem;
}

.admin-registration-form button {
    padding: .48rem .7rem;
}

.assign-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.assign-form select {
    width: 155px;
    margin: 0;
    padding: .55rem;
}

.assign-form button {
    padding: .55rem .7rem;
}

.registration-status {
    display: inline-block;
    margin-top: 6px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 750;
}

.volunteer-shift.is-pending {
    background: #fff8e8;
    border-color: #e7cf8d;
}

.volunteer-shift.is-assigned {
    background: var(--green-soft);
}

.volunteer-shift.is-reserve {
    background: #eee1f4;
}

.volunteer-shift.is-free-date {
    background: #f8deda;
}

.shift.assigned {
    background: var(--green-soft);
}

.shift.is-pending-admin-date {
    background: #fff8e8;
}

.shift.is-free-admin-date {
    background: #f8deda;
}

.dot.free { background: #c84f45; }
.dot.pending { background: #d3a52f; }
.dot.reserve { background: #8a64a0; }

.activity-log {
    display: grid;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.activity-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 17px 22px;
    border-bottom: 1px solid var(--line);
}

.activity-entry:last-child { border-bottom: 0; }
.activity-entry p { margin: 2px 0; color: var(--muted); font-size: .88rem; }
.activity-entry span { color: var(--green); font-size: .76rem; font-weight: 750; }

@media (max-width: 580px) {
    .session {
        gap: 8px;
    }

    .admin-nav a {
        padding: 5px 7px;
    }

    .list-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .list-heading-row button,
    .date-list-toolbar button {
        width: 100%;
    }

    .list-actions {
        width: 100%;
        flex-wrap: nowrap;
    }

    .schedule-filter {
        flex: 1;
    }

    .schedule-filter select {
        min-width: 0;
        flex: 1;
    }

    .list-heading-row .history-button {
        width: 44px;
        flex: 0 0 44px;
    }

    .volunteer-counts {
        width: 100%;
    }

    .volunteer-counts .my-count {
        flex: 1;
    }

    .profile-add-form,
    .profile-card {
        grid-template-columns: 1fr;
    }

    .profile-actions {
        flex-direction: column;
    }

    .admin-password-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .import-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .shift > .shift-actions {
        grid-column: 3;
        grid-row: 1;
    }

    .assign-form {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-registration-form {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-registration-form select {
        width: 100%;
    }

    .assign-form select { width: 100%; }
    .assignment { align-items: flex-start; }
    .activity-entry { grid-template-columns: 1fr; padding: 15px; }
}
