.volunteer-calendar-page {
    padding-top: 34px;
    padding-bottom: 28px;
}

.volunteer-calendar-container {
    max-width: 1280px;
}

.admin-calendar-page .volunteer-calendar-container.admin-with-roster {
    max-width: 1480px;
}

.volunteer-calendar-header {
    margin-bottom: 20px;
}

.volunteer-calendar-header h1 {
    margin: 0 0 10px;
    font-size: 3rem;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.volunteer-calendar-header p {
    margin: 0;
    max-width: 840px;
    color: #697089;
    font-size: 1.05rem;
    line-height: 1.7;
}

.volunteer-calendar-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.volunteer-calendar-toolbar {
    border-radius: 28px;
    overflow: hidden;
    margin-bottom: 24px;
}

.volunteer-calendar-toolbar-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
}

.volunteer-calendar-toolbar-nav,
.volunteer-calendar-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1 1 0;
}

.volunteer-calendar-toolbar-nav {
    justify-content: flex-start;
}

.volunteer-calendar-toolbar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.volunteer-calendar-range {
    display: grid;
    gap: 4px;
    text-align: center;
    justify-items: center;
}

.volunteer-calendar-range strong {
    font-size: 1.2rem;
    color: #232435;
}

.volunteer-calendar-range span {
    color: #707792;
    font-size: 0.95rem;
}

.volunteer-calendar-toolbar-actions {
    justify-content: flex-end;
}

.volunteer-calendar-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.volunteer-calendar-nav-button.is-current-week {
    background: rgba(124, 121, 184, 0.1);
    border-color: rgba(124, 121, 184, 0.22);
}

/* Grid + day card sizing moved to the .cal-* block at the bottom of
   the file so all calendar layout rules live in one place. */

.volunteer-calendar-day-card {
    border-radius: 18px;
    overflow: hidden;
}

.volunteer-calendar-day-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.volunteer-calendar-day-header h2 {
    margin: 0;
    font-size: 1rem;
}

.volunteer-calendar-day-header p {
    margin: 2px 0 0;
    color: #707792;
    font-size: 0.78rem;
}

.volunteer-calendar-events {
    display: grid;
    gap: 12px;
    align-content: start;
}

.volunteer-calendar-event {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #e2e6f2;
    background: linear-gradient(180deg, #fcfcff 0%, #f5f7fd 100%);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    align-content: start;
}

.volunteer-calendar-event:hover,
.volunteer-calendar-event:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(34, 42, 70, 0.08);
    border-color: #d4daee;
}

.volunteer-calendar-event:focus-visible {
    outline: 3px solid rgba(124, 121, 184, 0.18);
    outline-offset: 2px;
}

.volunteer-calendar-event.is-complete {
    background: linear-gradient(180deg, #f5fcf7 0%, #eef8f1 100%);
    border-color: #d8ebde;
}

.volunteer-calendar-event.is-ready {
    background: linear-gradient(180deg, #fcfbff 0%, #f3f0ff 100%);
    border-color: #ddd8f5;
}

.volunteer-calendar-event.is-past {
    background: linear-gradient(180deg, #fbfbfd 0%, #f2f4f9 100%);
}

.volunteer-calendar-event-time {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.volunteer-calendar-event-time strong {
    font-size: 1rem;
    color: #232435;
}

.volunteer-calendar-event-time span {
    color: #707792;
    font-size: 0.86rem;
}

.volunteer-calendar-event-main h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    line-height: 1.35;
}

.volunteer-calendar-event-main p {
    margin: 0;
    color: #5e6485;
    font-size: 0.92rem;
}

.volunteer-calendar-event-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.volunteer-calendar-empty-day {
    min-height: 120px;
    padding: 20px 18px;
    display: grid;
    place-items: center;
    text-align: center;
    color: #707792;
}

@media (max-width: 1200px) {
    .volunteer-calendar-container {
        max-width: 1140px;
    }
}

@media (max-width: 900px) {
    .volunteer-calendar-toolbar-body {
        flex-direction: column;
        align-items: stretch;
    }

    .volunteer-calendar-toolbar-center {
        order: -1;
        align-items: center;
    }

    .volunteer-calendar-range {
        text-align: center;
        justify-items: center;
    }

    .volunteer-calendar-toolbar-nav,
    .volunteer-calendar-toolbar-actions {
        justify-content: space-between;
    }

    .volunteer-calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .volunteer-calendar-header h1 {
        font-size: 2.45rem;
    }
}

@media (max-width: 640px) {
    .volunteer-calendar-page {
        padding-top: 18px;
        padding-bottom: 20px;
    }

    .volunteer-calendar-grid {
        grid-template-columns: 1fr;
    }

    .volunteer-calendar-nav-button {
        width: 100%;
    }

    .volunteer-calendar-day-body,
    .volunteer-calendar-toolbar .card-body {
        padding: 18px;
    }
}

/* === Vacation banner === */
.volunteer-calendar-vacation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff8e5 0%, #fff0c5 100%);
    border: 1px solid #ffe3a3;
}
.volunteer-calendar-vacation-emoji {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(216, 150, 47, 0.18);
    font-size: 1.2rem;
    line-height: 1;
    text-align: center;
    flex-shrink: 0;
}
.volunteer-calendar-vacation strong {
    color: #6b5118;
    font-size: 0.96rem;
}
.volunteer-calendar-vacation p {
    margin: 2px 0 0;
    color: #8a6d1f;
    font-size: 0.84rem;
}

/* === View-mode tabs (week / month) === */
.volunteer-calendar-view-tabs {
    display: inline-flex;
    background: rgba(124, 121, 184, 0.10);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.volunteer-calendar-view-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 700;
    color: #4f5273;
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.volunteer-calendar-view-tab:hover {
    color: #2a2c4a;
}

.volunteer-calendar-view-tab.is-active {
    background: #fff;
    color: #2a2c4a;
    box-shadow: 0 1px 2px rgba(31, 33, 60, 0.08);
}

/* === Month grid === */
.volunteer-calendar-month-grid {
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(31, 33, 60, 0.08);
    box-shadow: 0 1px 2px rgba(31, 33, 60, 0.04);
}

.volunteer-calendar-month-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: rgba(124, 121, 184, 0.08);
    border-bottom: 1px solid rgba(31, 33, 60, 0.06);
}

.volunteer-calendar-month-header span {
    padding: 12px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b6f8a;
}

.volunteer-calendar-month-body {
    display: grid;
    grid-template-rows: repeat(6, minmax(110px, 1fr));
}

.volunteer-calendar-month-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid rgba(31, 33, 60, 0.06);
}

.volunteer-calendar-month-week:first-child {
    border-top: 0;
}

.volunteer-calendar-month-day {
    position: relative;
    min-height: 110px;
    padding: 8px 8px 10px;
    border-right: 1px solid rgba(31, 33, 60, 0.06);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

.volunteer-calendar-month-day:last-child {
    border-right: 0;
}

.volunteer-calendar-month-day.is-out {
    background: rgba(241, 242, 248, 0.55);
}

.volunteer-calendar-month-day.is-out .volunteer-calendar-month-day-date span {
    color: #b3b6c8;
}

.volunteer-calendar-month-day.is-weekend {
    background: rgba(241, 242, 248, 0.35);
}

.volunteer-calendar-month-day.is-today {
    background: rgba(124, 121, 184, 0.08);
}

.volunteer-calendar-month-day-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #2a2c4a;
    font-size: 0.92rem;
    line-height: 1;
}

.volunteer-calendar-month-day.is-today .volunteer-calendar-month-day-date span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #6e6cc1;
    color: #fff;
    font-size: 0.82rem;
}

.volunteer-calendar-month-vacation {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff3cf;
    color: #6b5118;
    font-size: 0.72rem;
    font-weight: 600;
    width: max-content;
    max-width: 100%;
}

.volunteer-calendar-month-events {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.volunteer-calendar-month-event {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(124, 121, 184, 0.14);
    color: #2a2c4a;
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.volunteer-calendar-month-event strong {
    font-weight: 700;
    font-size: 0.76rem;
    color: #4d4f78;
}

.volunteer-calendar-month-event span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.volunteer-calendar-month-event.is-complete {
    background: rgba(64, 168, 96, 0.16);
    color: #1f5f37;
}
.volunteer-calendar-month-event.is-ready {
    background: rgba(255, 184, 77, 0.22);
    color: #7a4a05;
}
.volunteer-calendar-month-event.is-past {
    background: rgba(31, 33, 60, 0.06);
    color: #5e6178;
}

@media (max-width: 900px) {
    .volunteer-calendar-month-header span {
        padding: 8px 6px;
        font-size: 0.7rem;
    }
    .volunteer-calendar-month-day {
        min-height: 90px;
        padding: 6px;
    }
    .volunteer-calendar-month-event span {
        display: none;
    }
}

/* === Subscribe / ICS feed card ===
   Wrapped in a <details> so the panel is collapsed by default —
   volunteers and admins usually subscribe once and never need the
   panel again. They can click the summary row to expand. */
.calendar-subscribe-card {
    margin-bottom: 18px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        radial-gradient(circle at 0% 0%, rgba(124, 121, 184, 0.06), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(196, 232, 219, 0.12), transparent 60%),
        var(--surface);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.calendar-subscribe-card:hover {
    border-color: rgba(124, 121, 184, 0.30);
    box-shadow: 0 12px 24px rgba(34, 42, 70, 0.06);
}

.calendar-subscribe-summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 24px;
    gap: 14px;
    align-items: center;
    padding: 14px 20px;
}

.calendar-subscribe-summary::-webkit-details-marker { display: none; }

.calendar-subscribe-chevron {
    color: var(--muted);
    font-size: 1.1rem;
    transition: transform 0.18s ease;
    justify-self: end;
}

.calendar-subscribe-card[open] .calendar-subscribe-chevron {
    transform: rotate(180deg);
    color: var(--primary-dark);
}

.calendar-subscribe-card[open] .calendar-subscribe-summary {
    border-bottom: 1px solid var(--border);
}

.calendar-subscribe-body {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 24px 24px;
}

.calendar-subscribe-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.calendar-subscribe-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(124, 121, 184, 0.28);
}

.calendar-subscribe-text {
    flex: 1;
    min-width: 0;
}

.calendar-subscribe-text h2 {
    margin: 0 0 4px;
    font-size: 1.08rem;
    line-height: 1.3;
    color: var(--text);
    letter-spacing: -0.01em;
}

.calendar-subscribe-text p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 620px;
}

.calendar-subscribe-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-subscribe-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Provider tiles — Google, Apple, Outlook */
.calendar-subscribe-providers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.calendar-subscribe-provider {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    height: 56px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(34, 42, 70, 0.02);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.calendar-subscribe-provider:hover,
.calendar-subscribe-provider:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(124, 121, 184, 0.45);
    box-shadow: 0 10px 22px rgba(34, 42, 70, 0.08);
    background: #fff;
    outline: none;
}

.calendar-subscribe-provider-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
}

.calendar-subscribe-provider[data-provider="apple"] .calendar-subscribe-provider-mark {
    background: #111;
    color: #fff;
}

.calendar-subscribe-provider[data-provider="outlook"] .calendar-subscribe-provider-mark {
    background: #e6f1fb;
}

.calendar-subscribe-provider-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.calendar-subscribe-provider-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.calendar-subscribe-provider-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* URL row */
.calendar-subscribe-url {
    display: flex;
    gap: 8px;
    align-items: stretch;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calendar-subscribe-url:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 121, 184, 0.18);
}

.calendar-subscribe-url input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.84rem;
    color: var(--text);
}

.calendar-subscribe-url input:focus {
    outline: none;
}

.calendar-subscribe-iconbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.calendar-subscribe-iconbtn:hover {
    background: var(--primary-dark);
}

.calendar-subscribe-iconbtn-ghost {
    background: var(--accent);
    color: var(--primary-dark);
}

.calendar-subscribe-iconbtn-ghost:hover {
    background: #e0e5fa;
}

.calendar-subscribe-iconbtn.is-copied {
    background: var(--success);
}

.calendar-subscribe-iconbtn svg {
    flex-shrink: 0;
}

.calendar-subscribe-details {
    margin-top: 4px;
    border-top: 1px dashed rgba(124, 121, 184, 0.22);
    padding-top: 16px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.calendar-subscribe-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 14px;
}

.calendar-subscribe-details-grid strong {
    display: block;
    color: var(--text);
    font-size: 0.92rem;
    margin-bottom: 6px;
}

.calendar-subscribe-details-grid p {
    margin: 0;
    color: var(--muted);
}

.calendar-subscribe-details-grid ol {
    margin: 0;
    padding-left: 18px;
}

.calendar-subscribe-details > summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.92rem;
    padding: 4px 0;
    user-select: none;
}

.calendar-subscribe-details > summary::-webkit-details-marker {
    display: none;
}

.calendar-subscribe-details > summary:focus {
    outline: none;
}

.calendar-subscribe-details > summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 6px;
}

.calendar-subscribe-details-chev {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 1rem;
    font-weight: 800;
    transition: transform 0.18s ease, background 0.18s ease;
    line-height: 1;
}

.calendar-subscribe-details[open] .calendar-subscribe-details-chev {
    transform: rotate(90deg);
    background: rgba(124, 121, 184, 0.20);
}

.calendar-subscribe-details-grid li {
    margin-bottom: 4px;
    color: var(--text);
}

.calendar-subscribe-details-grid li::marker {
    color: var(--primary);
    font-weight: 700;
}

.calendar-subscribe-details a {
    color: var(--primary-dark);
    font-weight: 600;
}

@media (max-width: 600px) {
    .calendar-subscribe-body {
        padding: 22px;
        gap: 18px;
    }
    .calendar-subscribe-providers {
        grid-template-columns: 1fr;
    }
    .calendar-subscribe-iconbtn {
        padding: 0 12px;
    }
    .calendar-subscribe-iconbtn-label {
        display: none;
    }
}

/* ============================================================
   Custom volunteer events on the calendar — distinct from
   class sessions. "Personal" tasks use a warm amber tone,
   "group" activities use a teal tone, so users can spot them
   at a glance.
   ============================================================ */
.volunteer-calendar-custom-event {
    cursor: default;
    border-style: solid;
}

.volunteer-calendar-custom-event.is-personal {
    background: linear-gradient(180deg, #fff8ec 0%, #fff1d6 100%);
    border-color: #ffd9a3;
}

.volunteer-calendar-custom-event.is-personal h3 { color: #8a5418; }

.volunteer-calendar-custom-event.is-group {
    background: linear-gradient(180deg, #ecf6f2 0%, #d9ede4 100%);
    border-color: #b6d7c8;
}

.volunteer-calendar-custom-event.is-group h3 { color: #2d6a55; }

.volunteer-calendar-custom-event:hover,
.volunteer-calendar-custom-event:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(34, 42, 70, 0.08);
}

/* Month view tiny chips for custom events */
.volunteer-calendar-month-custom-event {
    border: 1px solid transparent;
}

.volunteer-calendar-month-custom-event.is-personal {
    background: #fff1d6;
    color: #8a5418;
    border-color: #ffd9a3;
}

.volunteer-calendar-month-custom-event.is-group {
    background: #d9ede4;
    color: #2d6a55;
    border-color: #b6d7c8;
}

.admin-calendar-event-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

/* Tiny "School" / "Social center" tag inline with an event title */
.volunteer-calendar-kind-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    vertical-align: middle;
    white-space: nowrap;
}

.volunteer-calendar-kind-school {
    color: var(--primary-dark);
    background: rgba(124, 121, 184, 0.10);
    border-color: rgba(124, 121, 184, 0.22);
}

.volunteer-calendar-kind-social {
    color: #2d6a55;
    background: rgba(95, 168, 147, 0.16);
    border-color: rgba(95, 168, 147, 0.32);
}

/* ============================================================
   Compact calendar event cards (.cal-event) — used on BOTH
   the admin calendar and the volunteer calendar week view.
   Designed for high information density: 4 px coloured left
   bar carries the status, time is prominent, title/sub are
   single line with ellipsis, and people are overlapping mini
   avatars so 5+ assignees fit inside a narrow column.
   ============================================================ */
.cal-day-events {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-day-empty {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
}

.cal-event {
    position: relative;
    padding: 8px 10px 8px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    display: grid;
    gap: 3px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    list-style: none;
    color: inherit;
    text-decoration: none;
}

.cal-event.is-clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hover overlay icon — only shown on admin-editable cards. Volunteers
   see no overlay icon since clicking opens a read-only detail modal. */
.cal-event.is-admin-editable::after {
    content: "↗";
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.78rem;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.cal-event.cal-event-custom.is-admin-editable::after { content: "✏️"; }

.cal-event.is-admin-editable:hover::after,
.cal-event.is-admin-editable:focus-visible::after { opacity: 0.7; }

.cal-event:hover,
.cal-event:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(34, 42, 70, 0.08);
    border-color: rgba(124, 121, 184, 0.45);
    outline: none;
}

.cal-event-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    line-height: 1.2;
    min-width: 0;
    flex-wrap: wrap;
}

.cal-event-time {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    flex-wrap: wrap;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0;
    line-height: 1.2;
}

.cal-event-time-end {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.cal-event-badge {
    font-size: 0.85rem;
    opacity: 0.65;
    line-height: 1;
    flex: 0 0 auto;
}

.cal-event-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-width: 0;
}

.cal-event-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-width: 0;
}

.cal-event-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* === Mini overlapping avatars for the people row === */
.cal-event-people {
    display: flex;
    flex-direction: row;
    margin-top: 4px;
    padding-left: 4px;
}

.cal-event-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(124, 121, 184, 0.18);
    color: var(--primary-dark);
    font-size: 0.66rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid #fff;
    margin-left: -6px;
    flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cal-event-avatar:first-child { margin-left: -4px; }

.cal-event-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cal-event-avatar-teacher {
    background: rgba(95, 168, 147, 0.22);
    color: #2d6a55;
    z-index: 2;
}

.cal-event-avatar-more {
    background: #f0f2fa;
    color: var(--primary-dark);
    font-weight: 800;
}

/* === Status & kind colouring via the left border bar === */
.cal-event-class { border-left-color: #7c79b8; }
.cal-event-class.is-evaluated { border-left-color: #2f7d57; background: linear-gradient(180deg, rgba(47, 125, 87, 0.04), #fff); }
.cal-event-class.is-ready { border-left-color: #d89a47; background: linear-gradient(180deg, rgba(216, 154, 71, 0.06), #fff); }
.cal-event-class.is-past { border-left-color: #c0c4d4; opacity: 0.7; }
.cal-event-class.is-moved { background: repeating-linear-gradient(45deg, rgba(124, 121, 184, 0.04), rgba(124, 121, 184, 0.04) 6px, transparent 6px, transparent 12px); }

.cal-event-custom { border-left-color: #5fa893; }
.cal-event-custom.is-group { background: linear-gradient(180deg, rgba(95, 168, 147, 0.10), #fff); border-left-color: #5fa893; }
.cal-event-custom.is-personal { background: linear-gradient(180deg, rgba(216, 154, 71, 0.10), #fff); border-left-color: #d89a47; }

/* Small inline flag chips ("ready to evaluate", "moved", …) */
.cal-event-flag {
    display: inline-block;
    width: fit-content;
    font-size: 0.66rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 4px;
}

.cal-event-flag-ready { color: #8a5418; background: #fff3d6; border: 1px solid #ffd9a3; }
.cal-event-flag-evaluated { color: #2f7d57; background: rgba(95, 168, 147, 0.18); border: 1px solid rgba(95, 168, 147, 0.32); }
.cal-event-flag-moved { color: #5f4ba0; background: rgba(124, 121, 184, 0.14); border: 1px solid rgba(124, 121, 184, 0.32); }

/* ============================================================
   Time-cluster: same-start-time events share a single header
   instead of repeating the time on every card. Looks like:

      ┌────────────────────────────┐
      │  14:00     · 3 events      │
      │ ┌────────────────────────┐ │
      │ │ ▌ Team meeting         │ │
      │ │ ▌ All volunteers       │ │
      │ ├────────────────────────┤ │
      │ │ ▌ Materials prep       │ │
      │ │ ▌ Gabriel              │ │
      │ ├────────────────────────┤ │
      │ │ ▌ Training session     │ │
      │ └────────────────────────┘ │
      └────────────────────────────┘
   ============================================================ */
.cal-cluster {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cal-cluster.is-multi {
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(124, 121, 184, 0.06) 0%, rgba(124, 121, 184, 0.02) 100%);
    border: 1px solid rgba(124, 121, 184, 0.22);
    overflow: hidden;
}

.cal-cluster-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    background: rgba(124, 121, 184, 0.12);
    border-bottom: 1px solid rgba(124, 121, 184, 0.18);
    min-width: 0;
}

.cal-cluster-time {
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.cal-cluster-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1;
}

/* In the compact (narrow column) calendar, the badge collapses to
   just the count, hiding the "events" word so it doesn't wrap. */
.cal-cluster-badge .cal-cluster-badge-word { display: none; }

.cal-cluster-events {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Cards inside a cluster: drop the time row, remove their own border
   radius, and use a thin separator between siblings. */
.cal-cluster-events .cal-event {
    border-radius: 0;
    border: none;
    border-left: 4px solid var(--primary);
    border-top: 1px solid rgba(124, 121, 184, 0.12);
    padding: 8px 10px 8px 12px;
    background: transparent;
}

.cal-cluster-events .cal-event:first-child { border-top: none; }

.cal-cluster-events .cal-event:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: none;
    box-shadow: none;
}

/* In compact mode (inside cluster) the head shrinks to just the badge */
.cal-event-head-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1;
    min-height: 16px;
}

.cal-event-head-compact .cal-event-badge {
    font-size: 0.85rem;
    opacity: 0.7;
}

.cal-event-head-compact .cal-event-time-end {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--muted);
}

.cal-event.is-compact {
    /* Vertical rhythm is tighter for clustered items */
    gap: 2px;
}

/* Cards shrink to their content rather than stretching to match the
   tallest column — uneven days look natural. */
.volunteer-calendar-day-card { align-self: start; }

/* The grid now renders all 7 days (Mon–Sun) — narrower columns work
   because each event card is densified. */
.volunteer-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

/* ============================================================
   Full-screen calendar — separate page, full viewport width,
   wider columns, bigger cards. Triggered by `.is-fullscreen`
   on the page section and `.cal-fullscreen-container` on the
   wrapper div.
   ============================================================ */
.cal-fullscreen-container {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 32px 48px;
    box-sizing: border-box;
}

/* Fullscreen + roster: two-column grid (volunteer sidebar | main calendar).
   Allows admins to filter to a single volunteer's week without going back to
   the compact view. Sidebar narrower than the planning page so the calendar
   gets the wide canvas it needs. */
.cal-fullscreen-with-roster {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

@media (max-width: 1080px) {
    .cal-fullscreen-with-roster {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .cal-fullscreen-container { padding: 16px; }
}

.cal-fullscreen-main { width: 100%; min-width: 0; }

.is-fullscreen .volunteer-calendar-grid {
    /* Wider columns so cards have real breathing room */
    gap: 14px;
}

.is-fullscreen .volunteer-calendar-day-card { min-height: 260px; }

.is-fullscreen .volunteer-calendar-day-body {
    padding: 18px;
    gap: 14px;
}

.is-fullscreen .volunteer-calendar-day-header h2 { font-size: 1.18rem; }
.is-fullscreen .volunteer-calendar-day-header p { font-size: 0.88rem; }

.is-fullscreen .cal-event {
    padding: 12px 14px 12px 16px;
    border-radius: 14px;
    gap: 6px;
}

.is-fullscreen .cal-event-time { font-size: 1rem; }
.is-fullscreen .cal-event-title { font-size: 0.98rem; -webkit-line-clamp: 3; }
.is-fullscreen .cal-event-sub { font-size: 0.84rem; -webkit-line-clamp: 2; }

.is-fullscreen .cal-event-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
}

.is-fullscreen .cal-cluster-head {
    padding: 8px 12px;
}

.is-fullscreen .cal-cluster-time { font-size: 1rem; }

.is-fullscreen .cal-cluster-badge {
    min-width: 26px;
    height: 26px;
    font-size: 0.78rem;
    padding: 0 10px;
}

/* In fullscreen mode there's enough room for the "events" word */
.is-fullscreen .cal-cluster-badge .cal-cluster-badge-word {
    display: inline;
    margin-left: 4px;
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: 0;
    opacity: 0.92;
}

.is-fullscreen .cal-cluster-events .cal-event { padding: 10px 12px 10px 14px; }

.is-fullscreen .cal-event-flag { font-size: 0.72rem; padding: 3px 10px; }

/* "↗ Full calendar" button on the compact view */
.cal-fullscreen-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(124, 121, 184, 0.12);
    color: var(--primary-dark);
    border: 1px solid rgba(124, 121, 184, 0.25);
    font-weight: 700;
    font-size: 0.86rem;
    text-decoration: none;
    margin-left: auto;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.cal-fullscreen-link:hover {
    background: rgba(124, 121, 184, 0.20);
    border-color: rgba(124, 121, 184, 0.45);
    transform: translateY(-1px);
}

/* "Full view" pill in the page title */
.cal-fullscreen-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: rgba(124, 121, 184, 0.16);
    border: 1px solid rgba(124, 121, 184, 0.30);
    padding: 4px 10px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 8px;
}

/* ============================================================
   Google-Calendar-style time-axis grid (.cal-timeline)
   Used in the fullscreen week view. The hour axis lives in the
   first column; each day occupies one of the remaining columns
   with events positioned absolutely.
   ============================================================ */
.cal-timeline {
    --cal-row-height: 56px;       /* one hour band height (compact view) */
    --cal-band-hours: 13;
    --cal-axis-width: 64px;
    display: grid;
    grid-template-columns: var(--cal-axis-width) minmax(0, 1fr);
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 16px 32px rgba(34, 42, 70, 0.06);
    overflow: hidden;
}

/* Fullscreen mode gets a much taller per-hour band so short events
   (e.g. a 30-min maternelle session) actually have room for the time,
   title and sub. With 104 px / hour, a 30-min event renders ~52 px tall
   in its absolute slot — comfortably legible — combined with the
   .cal-timeline-event min-height: 64px every card is fully readable. */
.is-fullscreen .cal-timeline {
    --cal-row-height: 104px;
}

/* In fullscreen the band is tall enough that we never need to compact
   short events to a single row — the multi-line layout fits naturally
   and reads much better. */
.is-fullscreen .cal-timeline-event[style*="height: 1."],
.is-fullscreen .cal-timeline-event[style*="height: 2."],
.is-fullscreen .cal-timeline-event[style*="height: 3."],
.is-fullscreen .cal-timeline-event[style*="height: 4."],
.is-fullscreen .cal-timeline-event[style*="height: 5."] {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    min-height: 52px;
}

.is-fullscreen .cal-timeline-event[style*="height: 1."] .cal-timeline-event-time span,
.is-fullscreen .cal-timeline-event[style*="height: 2."] .cal-timeline-event-time span,
.is-fullscreen .cal-timeline-event[style*="height: 3."] .cal-timeline-event-time span,
.is-fullscreen .cal-timeline-event[style*="height: 4."] .cal-timeline-event-time span,
.is-fullscreen .cal-timeline-event[style*="height: 5."] .cal-timeline-event-time span,
.is-fullscreen .cal-timeline-event[style*="height: 1."] .cal-timeline-event-sub,
.is-fullscreen .cal-timeline-event[style*="height: 2."] .cal-timeline-event-sub,
.is-fullscreen .cal-timeline-event[style*="height: 3."] .cal-timeline-event-sub,
.is-fullscreen .cal-timeline-event[style*="height: 4."] .cal-timeline-event-sub,
.is-fullscreen .cal-timeline-event[style*="height: 5."] .cal-timeline-event-sub,
.is-fullscreen .cal-timeline-event[style*="height: 1."] .cal-timeline-event-people,
.is-fullscreen .cal-timeline-event[style*="height: 2."] .cal-timeline-event-people,
.is-fullscreen .cal-timeline-event[style*="height: 3."] .cal-timeline-event-people,
.is-fullscreen .cal-timeline-event[style*="height: 4."] .cal-timeline-event-people,
.is-fullscreen .cal-timeline-event[style*="height: 5."] .cal-timeline-event-people {
    display: flex;
}

/* Hour axis column on the left */
.cal-timeline-axis {
    display: grid;
    grid-template-rows: 44px repeat(var(--cal-band-hours), var(--cal-row-height));
    background: linear-gradient(180deg, rgba(124, 121, 184, 0.04), rgba(124, 121, 184, 0.02));
    border-right: 1px solid var(--border);
}

.cal-timeline-axis-spacer { /* aligns with day headers */ }

.cal-timeline-axis-hour {
    position: relative;
    border-top: 1px solid rgba(124, 121, 184, 0.10);
}

.cal-timeline-axis-hour span {
    position: absolute;
    top: -8px;
    right: 8px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--muted);
    background: #fff;
    padding: 0 4px;
    line-height: 1;
}

.cal-timeline-axis-hour:first-of-type span { top: 4px; }

/* Day columns */
.cal-timeline-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #fff;
}

.cal-timeline-day {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cal-timeline-day:last-child { border-right: none; }

.cal-timeline-day.is-weekend { background: linear-gradient(180deg, rgba(124, 121, 184, 0.03), transparent); }

.cal-timeline-day.is-today { background: rgba(124, 121, 184, 0.04); }

.cal-timeline-day-header {
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border);
    text-align: center;
    line-height: 1.1;
    background: rgba(255, 255, 255, 0.95);
    position: sticky;
    top: 0;
    z-index: 5;
}

.cal-timeline-day-header strong {
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.cal-timeline-day-header span {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
    margin-top: 1px;
}

.cal-timeline-day.is-today .cal-timeline-day-header strong { color: var(--primary); }
.cal-timeline-day.is-today .cal-timeline-day-header span { color: var(--primary-dark); }

/* The actual time band where events live, with hour grid lines */
.cal-timeline-day-grid {
    position: relative;
    flex: 1 1 auto;
    height: calc(var(--cal-band-hours) * var(--cal-row-height));
}

.cal-timeline-grid-line {
    height: var(--cal-row-height);
    border-top: 1px solid rgba(124, 121, 184, 0.10);
}

.cal-timeline-grid-line:nth-child(2n) {
    border-top-color: rgba(124, 121, 184, 0.05);
}

/* Absolutely-positioned event block. The base class works for both
   <article> (volunteer events → modal) and <a> (class sessions → link
   to class planning) so they look identical. */
/* ──── Overlap clusters ──────────────────────────────────────────
   When 2+ events overlap, we DON'T render them side-by-side any more —
   they'd each get a tiny illegible column. Instead the template emits
   a single "cluster panel" spanning the cluster's time range, with a
   vertical list of rows inside. Each row shows time + title + sub for
   one event and behaves the same way the standalone card would
   (admin → planning page link; volunteer → detail modal trigger). */
.cal-timeline-cluster {
    position: absolute;
    box-sizing: border-box;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
    border: 1.5px solid rgba(124, 121, 184, 0.32);
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(34, 42, 70, 0.08);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    z-index: 5;
}

.cal-timeline-cluster-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(124, 121, 184, 0.10);
    border-bottom: 1px solid rgba(124, 121, 184, 0.18);
}

.cal-timeline-cluster-time {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 0.82rem;
}

.cal-timeline-cluster-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cal-timeline-cluster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
}

.cal-timeline-cluster-list li + li {
    border-top: 1px solid rgba(34, 42, 70, 0.05);
}

.cal-timeline-cluster-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    width: 100%;
    background: transparent;
    border: none;
    border-left: 3px solid var(--primary);
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease, border-left-color 0.12s ease;
}

a.cal-timeline-cluster-row { display: grid; }
a.cal-timeline-cluster-row:hover { text-decoration: none; color: inherit; }

.cal-timeline-cluster-row:hover {
    background: rgba(124, 121, 184, 0.08);
}

.cal-timeline-cluster-row:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.cal-timeline-cluster-row-time {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--primary-dark);
    white-space: nowrap;
    min-width: 36px;
}

.cal-timeline-cluster-row-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.cal-timeline-cluster-row-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-timeline-cluster-row-sub {
    font-size: 0.7rem;
    color: var(--muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Per-kind accent on cluster rows */
.cal-cluster-row-class { border-left-color: #7c79b8; }
.cal-cluster-row-class.is-evaluated { border-left-color: #2f7d57; }
.cal-cluster-row-class.is-ready { border-left-color: #d89a47; }
.cal-cluster-row-class.is-past { border-left-color: #c0c4d4; opacity: 0.7; }
.cal-cluster-row-class.is-moved {
    background: repeating-linear-gradient(45deg, rgba(124, 121, 184, 0.05), rgba(124, 121, 184, 0.05) 6px, transparent 6px, transparent 12px);
}
.cal-cluster-row-custom.is-group { border-left-color: #5fa893; }
.cal-cluster-row-custom.is-personal { border-left-color: #d89a47; }

.cal-timeline-event {
    position: absolute;
    box-sizing: border-box;
    padding: 6px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff 0%, #fafbff 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                border-color 0.15s ease, left 0.18s ease, width 0.18s ease,
                z-index 0s linear 0.18s;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Min-height guarantees a 30-min event still shows time+title even
       if its absolute slot ends up too short. The card visually
       extends past its slot — that's fine; the next event is anchored
       to its own top_pct and the cluster path handles real overlaps. */
    min-height: 64px;
    font-size: 0.85rem;
}

a.cal-timeline-event:hover { text-decoration: none; color: inherit; }

/* Hover expansion — overlapping events get a fraction of the column width
   (e.g. 3 stacked events = ~33% each, often too narrow to read). When the
   user hovers/focuses one, snap it to nearly full column width so they can
   actually see the title, sub-line, and avatars. The transition is fast
   enough to feel responsive but smooth enough not to flicker. */
.cal-timeline-event:hover,
.cal-timeline-event:focus-visible,
.cal-timeline-event:focus-within {
    z-index: 30;
    left: 2px !important;
    width: calc(100% - 4px) !important;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(34, 42, 70, 0.18);
    border-color: rgba(124, 121, 184, 0.55);
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                border-color 0.15s ease, left 0.15s ease, width 0.15s ease,
                z-index 0s;
}

.cal-timeline-event.is-clickable {
    cursor: pointer;
}

/* Pencil ✏️ overlay ONLY for admin-editable blocks. Volunteer-facing
   blocks open a read-only detail modal, so they get no overlay icon. */
.cal-timeline-event.is-admin-editable::after {
    content: "✏️";
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.74rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.cal-timeline-event.is-admin-editable:hover::after,
.cal-timeline-event.is-admin-editable:focus-visible::after {
    opacity: 0.8;
}

.cal-timeline-event.is-clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.cal-timeline-event.cal-event-class { border-left-color: #7c79b8; }
.cal-timeline-event.cal-event-class.is-evaluated { border-left-color: #2f7d57; background: linear-gradient(180deg, rgba(47, 125, 87, 0.06), #fff); }
.cal-timeline-event.cal-event-class.is-past { border-left-color: #c0c4d4; opacity: 0.72; }
.cal-timeline-event.cal-event-class.is-moved { background: repeating-linear-gradient(45deg, rgba(124, 121, 184, 0.05), rgba(124, 121, 184, 0.05) 6px, transparent 6px, transparent 12px); }

.cal-timeline-event.cal-event-custom.is-group {
    background: linear-gradient(180deg, rgba(95, 168, 147, 0.14), #fff);
    border-left-color: #5fa893;
}

.cal-timeline-event.cal-event-custom.is-personal {
    background: linear-gradient(180deg, rgba(216, 154, 71, 0.14), #fff);
    border-left-color: #d89a47;
}

.cal-timeline-event-time {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.72rem;
    line-height: 1;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* When the event card is narrow (less than ~80px because of overlapping
   columns), the end-time becomes the first thing to drop — it's the
   least useful piece of info compared to the title. */
.cal-timeline-event:not(:hover):not(:focus-within) .cal-timeline-event-time span:not(strong) {
    display: none;
}

.cal-timeline-event-time strong {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text);
}

.cal-timeline-event-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cal-timeline-event-sub {
    margin: 0;
    font-size: 0.7rem;
    color: var(--muted);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-timeline-event-people {
    display: flex;
    margin-top: 2px;
    padding-left: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.cal-timeline-event-people .cal-event-avatar {
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    border-width: 1.5px;
    margin-left: -5px;
}

/* ──── Short events: switch to single-line layout ──────────────────
   Events under ~50 minutes don't have enough vertical room for the
   stacked time/title/sub/people layout. We flip them to a horizontal
   row so the start-time stays bold on the left and the title flows
   to the right with ellipsis. The end-time, sub, and avatars are
   hidden — they're still visible on hover (`title` attr) and in the
   edit modal. */
.cal-timeline-event[style*="height: 1."],
.cal-timeline-event[style*="height: 2."],
.cal-timeline-event[style*="height: 3."],
.cal-timeline-event[style*="height: 4."],
.cal-timeline-event[style*="height: 5."] {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    min-height: 26px;
}

/* Hide content that can't fit on a single line */
.cal-timeline-event[style*="height: 1."] .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 1."] .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 1."] .cal-timeline-event-people,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-people,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-people,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-people,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-people {
    display: none;
}

/* On hover, blow short events back up to the full multi-line layout
   so the title, sub-line, and avatars are visible again. Combined with
   the horizontal width-expansion rule above, this makes a row of three
   tiny stacked events fully legible once you point at one. */
.cal-timeline-event[style*="height: 1."]:hover,
.cal-timeline-event[style*="height: 2."]:hover,
.cal-timeline-event[style*="height: 3."]:hover,
.cal-timeline-event[style*="height: 4."]:hover,
.cal-timeline-event[style*="height: 5."]:hover,
.cal-timeline-event[style*="height: 1."]:focus-within,
.cal-timeline-event[style*="height: 2."]:focus-within,
.cal-timeline-event[style*="height: 3."]:focus-within,
.cal-timeline-event[style*="height: 4."]:focus-within,
.cal-timeline-event[style*="height: 5."]:focus-within {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    min-height: 64px;
    /* Stretch downward so the expanded card never collides with grid lines
       below — a 26px-tall card jumps to 80px when hovered. */
    height: auto !important;
}

.cal-timeline-event[style*="height: 1."]:hover .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 2."]:hover .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 3."]:hover .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 4."]:hover .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 5."]:hover .cal-timeline-event-time span,
.cal-timeline-event[style*="height: 1."]:hover .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 2."]:hover .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 3."]:hover .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 4."]:hover .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 5."]:hover .cal-timeline-event-sub,
.cal-timeline-event[style*="height: 1."]:hover .cal-timeline-event-people,
.cal-timeline-event[style*="height: 2."]:hover .cal-timeline-event-people,
.cal-timeline-event[style*="height: 3."]:hover .cal-timeline-event-people,
.cal-timeline-event[style*="height: 4."]:hover .cal-timeline-event-people,
.cal-timeline-event[style*="height: 5."]:hover .cal-timeline-event-people {
    display: flex;
}

/* Tighten the time + title so they fit on one row */
.cal-timeline-event[style*="height: 1."] .cal-timeline-event-time,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-time,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-time,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-time,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-time {
    flex: 0 0 auto;
}

.cal-timeline-event[style*="height: 1."] .cal-timeline-event-time strong,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-time strong,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-time strong,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-time strong,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-time strong {
    font-size: 0.74rem;
}

.cal-timeline-event[style*="height: 1."] .cal-timeline-event-title,
.cal-timeline-event[style*="height: 2."] .cal-timeline-event-title,
.cal-timeline-event[style*="height: 3."] .cal-timeline-event-title,
.cal-timeline-event[style*="height: 4."] .cal-timeline-event-title,
.cal-timeline-event[style*="height: 5."] .cal-timeline-event-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.78rem;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* On hover, briefly enlarge a short event so its full info is readable
   without opening the modal. Uses a CSS-only popover via z-index + max
   height growth. */
.cal-timeline-event.is-clickable[style*="height: 1."]:hover,
.cal-timeline-event.is-clickable[style*="height: 2."]:hover,
.cal-timeline-event.is-clickable[style*="height: 3."]:hover,
.cal-timeline-event.is-clickable[style*="height: 4."]:hover,
.cal-timeline-event.is-clickable[style*="height: 5."]:hover,
.cal-timeline-event.is-clickable[style*="height: 1."]:focus-visible,
.cal-timeline-event.is-clickable[style*="height: 2."]:focus-visible,
.cal-timeline-event.is-clickable[style*="height: 3."]:focus-visible,
.cal-timeline-event.is-clickable[style*="height: 4."]:focus-visible,
.cal-timeline-event.is-clickable[style*="height: 5."]:focus-visible {
    height: auto !important;
    min-height: 76px;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px 10px !important;
    gap: 2px !important;
    z-index: 6;
}

.cal-timeline-event.is-clickable[style*="height: 1."]:hover .cal-timeline-event-time span,
.cal-timeline-event.is-clickable[style*="height: 2."]:hover .cal-timeline-event-time span,
.cal-timeline-event.is-clickable[style*="height: 3."]:hover .cal-timeline-event-time span,
.cal-timeline-event.is-clickable[style*="height: 4."]:hover .cal-timeline-event-time span,
.cal-timeline-event.is-clickable[style*="height: 5."]:hover .cal-timeline-event-time span,
.cal-timeline-event.is-clickable[style*="height: 1."]:hover .cal-timeline-event-sub,
.cal-timeline-event.is-clickable[style*="height: 2."]:hover .cal-timeline-event-sub,
.cal-timeline-event.is-clickable[style*="height: 3."]:hover .cal-timeline-event-sub,
.cal-timeline-event.is-clickable[style*="height: 4."]:hover .cal-timeline-event-sub,
.cal-timeline-event.is-clickable[style*="height: 5."]:hover .cal-timeline-event-sub {
    display: block;
}

.cal-timeline-event.is-clickable[style*="height: 1."]:hover .cal-timeline-event-title,
.cal-timeline-event.is-clickable[style*="height: 2."]:hover .cal-timeline-event-title,
.cal-timeline-event.is-clickable[style*="height: 3."]:hover .cal-timeline-event-title,
.cal-timeline-event.is-clickable[style*="height: 4."]:hover .cal-timeline-event-title,
.cal-timeline-event.is-clickable[style*="height: 5."]:hover .cal-timeline-event-title {
    white-space: normal;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 0.82rem;
}

/* Vacation banner positioned at the top of the day grid */
.cal-timeline-vacation {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(216, 154, 71, 0.16);
    color: #8a5418;
    font-size: 0.72rem;
    font-weight: 700;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .volunteer-calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    .volunteer-calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .volunteer-calendar-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   Admin class-event detail modal — shown when an admin clicks a
   class-session block on the calendar. Read-only summary first,
   then a CTA that jumps to class planning.
   ============================================================ */
.cal-class-detail {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 8px 4px;
}

.cal-class-detail-hero {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-class-detail-kicker {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(124, 121, 184, 0.12);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.88rem;
    width: fit-content;
}

.cal-class-detail-hero h2 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--text);
    line-height: 1.15;
}

.cal-class-detail-sub {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.4;
}

.cal-class-detail-flag {
    color: #b34b22;
    font-weight: 700;
}

.cal-class-detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cal-class-detail-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--border);
    min-width: 0;
}

.cal-class-detail-chip-key {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.cal-class-detail-chip-value {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text);
}

.cal-class-detail-chip-course {
    background: linear-gradient(135deg, rgba(124, 121, 184, 0.12), rgba(124, 121, 184, 0.04));
    border-color: rgba(124, 121, 184, 0.28);
}
.cal-class-detail-chip-course .cal-class-detail-chip-value { color: var(--primary-dark); }

.cal-class-detail-chip-done {
    background: rgba(47, 125, 87, 0.10);
    border-color: rgba(47, 125, 87, 0.28);
}
.cal-class-detail-chip-done .cal-class-detail-chip-value { color: #2f7d57; }

.cal-class-detail-chip-warn {
    background: rgba(255, 184, 96, 0.16);
    border-color: rgba(217, 124, 74, 0.30);
}
.cal-class-detail-chip-warn .cal-class-detail-chip-value { color: #b34b22; }

.cal-class-detail-people h3 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
}

.cal-class-detail-people-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.cal-class-detail-person {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    border: 1px solid var(--border);
}

.cal-class-detail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    overflow: hidden;
    flex: 0 0 auto;
}

.cal-class-detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cal-class-detail-person-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.cal-class-detail-person-text strong {
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
}

.cal-class-detail-person-text span {
    color: var(--muted);
    font-size: 0.82rem;
}

.cal-class-detail-empty {
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

.cal-class-detail-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.cal-class-detail-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(124, 121, 184, 0.30);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cal-class-detail-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(124, 121, 184, 0.40);
    color: #fff;
    text-decoration: none;
}

.cal-class-detail-cta-secondary {
    background: rgba(124, 121, 184, 0.10);
    color: var(--primary-dark);
    box-shadow: none;
    border: 1px solid rgba(124, 121, 184, 0.32);
}

.cal-class-detail-cta-secondary:hover {
    background: rgba(124, 121, 184, 0.18);
    color: var(--primary-dark);
}
