.officehours-section {
    margin-top: 0;
    --officehours-available-green: var(--theme-reservation-slot-available);
    --officehours-day-border-color: var(--theme-divider-dotted);
    --officehours-slot-border-color: var(--theme-divider-dotted);
    --officehours-day-columns: 7;
}

.officehours-intro-block {
    margin: 0 0 8px 0;
    margin-top: calc(var(--nav-box-height) + var(--nav-border-bottom-thk) - var(--main-padding-top));
    margin-left: calc(-1 * var(--main-padding-left));
    margin-right: calc(-1 * var(--main-padding-right));
    padding: var(--box-content-padding);
    background: transparent;
    color: var(--theme-text);
    border-bottom: 1px solid var(--theme-divider-strong);
}

/* The intro block owns this boundary; a second nearby disclosure line reads as a double divider. */
.officehours-intro-block > .instruction-disclosure {
    border-bottom: 0;
}

.officehours-section h5 {
    margin: 0 0 var(--type-space-content);
    font-size: var(--type-size-content-title);
    font-weight: 700;
    line-height: var(--type-leading-heading);
}

.officehours-section > p {
    margin: 0;
    font-size: var(--type-size-content-description);
    line-height: var(--type-leading-reading);
}

.officehours-overview-list {
    margin: 0;
    padding-left: 18px;
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

.officehours-intro-block h5,
.officehours-intro-block ul,
.officehours-intro-block li {
    color: var(--theme-text);
}

.officehours-overview-list li + li {
    margin-top: var(--type-space-tight);
}

.officehours-messages {
    display: none;
}

.officehours-messages.is-fallback {
    display: grid;
    gap: var(--type-space-tight);
    margin: var(--type-space-compact) 0 0;
    padding: 0;
    list-style: none;
}

.officehours-messages.is-fallback > li {
    padding: var(--type-space-compact);
    border: 1px solid var(--theme-warning-text);
    background: var(--theme-warning-bg);
    color: var(--theme-warning-text);
}

.officehours-message {
    margin: 0;
    padding: var(--type-space-compact);
    border: 1px solid var(--theme-border);
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

.officehours-message.success {
    background: var(--theme-success-bg);
}

.officehours-message.error {
    background: var(--theme-error-bg);
}

.officehours-message + .officehours-message {
    margin-top: 6px;
}

.officehours-inline-message {
    margin-top: 8px;
}

.officehours-topbar {
    margin-top: var(--type-space-content);
    margin-bottom: var(--type-space-content);
    padding: var(--type-space-compact) 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    transition: column-gap 0.16s ease, padding 0.16s ease;
}

.officehours-month-nav {
    display: grid;
    /* Keep the outer width stable while giving the full English month label room. */
    grid-template-columns: 28px 196px 28px;
    align-items: center;
    column-gap: 2px;
    grid-column: 2;
    justify-self: center;
}

#officehours-month-label {
    margin: 0;
    font-size: clamp(22px, 2.3vw, 24px);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    width: 196px;
    padding: 0;
    white-space: nowrap;
}

.officehours-month-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
}

.officehours-month-arrow:hover {
    background: var(--theme-surface-hover);
}

.officehours-month-arrow:disabled {
    color: var(--theme-calendar-disabled);
    cursor: not-allowed;
    text-decoration: none;
}

.officehours-month-arrow:disabled .reservation-control-icon {
    opacity: 0.35;
}

.officehours-legend {
    margin: 0;
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 12px;
    font-size: clamp(13px, 1.15vw, calc(var(--nav-font-size) * 1.02));
    font-weight: 400;
    line-height: 1.4;
    min-width: 0;
    white-space: nowrap;
    transition: gap 0.16s ease, font-size 0.16s ease;
}

.officehours-legend > span {
    display: inline-flex;
    align-items: center;
}

.officehours-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px dotted var(--officehours-slot-border-color);
    margin-right: 5px;
    vertical-align: baseline;
}

.officehours-dot-unavailable {
    background: var(--theme-surface);
}

.officehours-dot-available {
    background: var(--officehours-available-green);
}

.officehours-dot-booked {
    background: var(--theme-reservation-slot-booked);
}

.officehours-month-panel {
    display: none;
    margin-top: var(--type-space-content);
    margin-bottom: var(--type-space-content);
}

.officehours-month-panel.is-active {
    display: block;
}

.officehours-admin-tools {
    margin: 0 0 8px 0;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: flex-end;
    padding: var(--type-space-compact);
    border: 1px solid var(--theme-admin-menu-border);
    border-radius: 8px;
    background: var(--theme-accent-surface);
    font-family: var(--body-font);
    font-size: var(--code-display-font-size);
}

.officehours-admin-menu-item {
    border: 0;
    background: transparent;
    color: var(--theme-text);
    font-family: inherit;
    font-size: inherit !important;
    line-height: 1.4;
    padding: 0;
    cursor: pointer;
    font-style: italic;
    font-weight: 400;
}

.officehours-admin-menu-item:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.officehours-admin-menu-item.is-active {
    color: var(--theme-text);
    font-style: italic;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.officehours-bookings-panel {
    margin: 0 0 var(--type-space-content) 0;
    padding: var(--type-space-content);
    border: 1px solid var(--theme-admin-menu-border);
    border-radius: 8px;
    background: var(--theme-accent-surface);
    font-family: var(--body-font);
    font-size: var(--code-display-font-size);
}

.officehours-bookings-panel h6 {
    margin: 0 0 4px 0;
    font-size: inherit;
    line-height: 1.4;
}

.officehours-bookings-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.officehours-bookings-item {
    margin: 0;
    padding: 2px 0;
    border-top: 1px dotted var(--theme-divider-dotted);
    font-size: inherit;
    line-height: 1.4;
}

.officehours-bookings-item:first-child {
    border-top: 0;
}

.officehours-bookings-slot {
    font-weight: 700;
    margin-right: 8px;
}

#officehours-bookings-empty {
    margin: 0;
    font-size: inherit;
    line-height: 1.4;
}

.officehours-days-grid {
    display: grid;
    grid-template-columns: repeat(var(--officehours-day-columns), minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 1100px) {
    .officehours-topbar {
        column-gap: 8px;
    }

    .officehours-month-nav {
        grid-template-columns: 24px 188px 24px;
    }

    #officehours-month-label {
        width: 188px;
    }

    .officehours-legend {
        gap: 8px;
        font-size: clamp(12px, 1.05vw, 14px);
    }
}

@media (max-width: 1600px) {
    .officehours-section {
        --officehours-day-columns: 6;
    }
}

@media (max-width: 1400px) {
    .officehours-section {
        --officehours-day-columns: 5;
    }
}

@media (max-width: 1200px) {
    .officehours-section {
        --officehours-day-columns: 4;
    }
}

@media (max-width: 960px) {
    .officehours-section {
        --officehours-day-columns: 3;
    }
}

.officehours-day-card {
    border: 1px dotted var(--officehours-day-border-color);
    padding: var(--type-space-compact);
    min-width: 0;
}

.officehours-day-card.is-placeholder {
    visibility: hidden;
}

.officehours-day-empty {
    min-height: 1px;
}

.officehours-day-card h6 {
    margin: 0 0 4px 0;
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

.officehours-slot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.officehours-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px dotted var(--theme-divider-dotted);
    border-radius: 9px;
    min-height: 30px;
    padding: 2px;
    font-size: calc(var(--main-font-size) * 0.8) !important;
    line-height: 1.3;
    text-align: center;
    color: var(--theme-text);
    background: var(--theme-surface);
}

.officehours-slot.is-unavailable {
    background: var(--theme-unavailable-bg);
    color: var(--theme-slot-unavailable-text);
}

.officehours-slot.is-booked {
    background: var(--theme-reservation-slot-booked);
    color: var(--theme-reservation-slot-booked-text);
    font-weight: 700;
}

.officehours-slot.is-available {
    background: var(--officehours-available-green);
    color: var(--theme-reservation-slot-available-text);
    font-weight: 700;
    cursor: pointer;
}

.officehours-slot.is-available:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.officehours-slot.is-available.is-selected {
    border: 2px solid var(--theme-border);
    font-weight: 700;
}

.officehours-booking-modal[hidden] {
    display: none;
}

.officehours-booking-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
}

.officehours-booking-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: var(--theme-overlay-soft);
}

.officehours-booking-dialog {
    position: relative;
    width: min(540px, calc(100vw - 24px));
    background: var(--theme-surface);
    border: 0;
    padding: var(--type-space-content);
    box-sizing: border-box;
}

.officehours-booking-close {
    position: absolute;
    top: 6px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 3px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.reservation-control-icon,
.reservation-close-icon {
    display: block;
    object-fit: contain;
}

.officehours-booking-dialog h6 {
    margin: 0;
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

#officehours-selected-slot {
    margin: 4px 0 0 0;
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

.officehours-booking-form {
    margin-top: 8px;
}

.officehours-booking-fields {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    row-gap: 6px;
    column-gap: 10px;
    align-items: center;
}

.officehours-booking-fields label {
    font-size: var(--nav-font-size);
    line-height: 1.4;
}

.officehours-account-email {
    overflow-wrap: anywhere;
    color: var(--theme-text-secondary);
}

.officehours-verification-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--type-space-compact);
    margin-top: var(--type-space-content);
}

.officehours-verification-actions #officehours-submit-btn,
.officehours-verification-actions #officehours-cancel-submit-btn {
    margin: 0;
}

.officehours-code-resend-btn {
    border: 1px solid var(--theme-text-subtle);
    border-radius: 4px;
    padding-block: var(--type-control-padding-block);
    padding-inline: var(--type-control-padding-inline);
    background: var(--theme-secondary-button-bg);
    color: var(--theme-text-strong);
    cursor: pointer;
}

.officehours-code-resend-btn[data-confirm-code-resend="true"] {
    border-color: var(--theme-caution-action);
    background: var(--theme-caution-action);
    color: var(--theme-caution-action-text);
}

.officehours-code-resend-btn[data-confirm-code-resend="true"]:is(:hover, :focus-visible) {
    border-color: var(--theme-caution-action-hover);
    background: var(--theme-caution-action-hover);
    color: var(--theme-caution-action-text);
}

.officehours-code-resend-btn:disabled {
    color: var(--theme-text-subtle);
    cursor: wait;
}

.officehours-code-status {
    grid-column: 2;
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: var(--type-size-small);
    line-height: var(--type-leading-reading);
}

.officehours-member-shortcut-hint {
    margin-top: var(--type-space-compact);
    color: var(--theme-text-muted);
    font-size: var(--type-size-small);
    line-height: var(--type-leading-reading);
}

.officehours-member-shortcut-hint p {
    margin: 0;
}

.officehours-member-shortcut-hint p + p {
    margin-top: var(--type-space-tight);
}

.officehours-booking-fields input,
.officehours-booking-fields textarea {
    width: 100%;
    border: 0;
    border-bottom: 1px dotted var(--theme-divider-dotted);
    background: var(--theme-control-bg);
    color: var(--theme-text);
    font-size: var(--nav-font-size);
    line-height: 1.4;
    padding: 2px 0;
    box-sizing: border-box;
}

.officehours-booking-fields textarea {
    resize: vertical;
    min-height: 44px;
}

#officehours-submit-btn {
    margin-top: var(--type-space-content);
    margin-left: auto;
    margin-right: auto;
    display: block;
    border: 1px solid var(--theme-text-subtle);
    background: var(--theme-button-bg);
    color: var(--theme-text);
    font-size: var(--nav-font-size);
    line-height: 1.4;
    padding-block: var(--type-control-padding-block);
    padding-inline: var(--type-control-padding-inline);
    cursor: pointer;
}

#officehours-cancel-submit-btn {
    margin-top: var(--type-space-content);
    margin-left: auto;
    margin-right: auto;
    display: block;
    border: 1px solid var(--theme-text-subtle);
    background: var(--theme-button-bg);
    color: var(--theme-text);
    font-size: var(--nav-font-size);
    line-height: 1.4;
    padding-block: var(--type-control-padding-block);
    padding-inline: var(--type-control-padding-inline);
    cursor: pointer;
}

#officehours-submit-btn:hover {
    background: var(--theme-button-hover);
}

#officehours-cancel-submit-btn:hover {
    background: var(--theme-button-hover);
}

#officehours-submit-btn:disabled,
#officehours-cancel-submit-btn:disabled {
    background: var(--theme-control-disabled-bg);
    color: var(--theme-control-disabled-text);
    cursor: wait;
}

@media (max-width: 800px) {
    .officehours-topbar {
        grid-template-columns: 1fr;
        row-gap: 8px;
        min-height: 0;
        padding: var(--type-space-compact) 0;
        justify-items: center;
    }

    .officehours-month-nav {
        grid-column: 1;
        justify-self: center;
    }

    .officehours-legend {
        grid-column: 1;
        justify-self: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        white-space: normal;
    }
}

@media (max-width: 760px) {
    .officehours-section {
        --officehours-day-columns: 2;
    }
}

@media (max-width: 650px) {
    .officehours-admin-tools {
        margin-top: 8px;
    }

    .officehours-admin-menu-item,
    .officehours-admin-menu-item.is-active {
        font-style: italic;
        font-weight: 400;
    }

    #officehours-month-label {
        font-size: 22px;
    }

    .officehours-booking-fields {
        grid-template-columns: 1fr;
        row-gap: 4px;
    }

    .officehours-code-status {
        grid-column: 1;
    }
}
