html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    max-width: 100%;
    overflow-x: hidden;
}

.main,
.panel,
.panel-header,
.filters,
.form-layout,
.form-panel,
.wizard-form,
.wizard-step,
.wizard-grid,
.resource-layout,
.admin-reservation-row,
.history-row,
.reservation-row,
.reservation-main,
.person {
    min-width: 0;
}

.filters > *,
.wizard-grid > *,
.resource-layout > *,
.reservation-row > *,
.admin-reservation-row > *,
.history-row > * {
    min-width: 0;
    max-width: 100%;
}

input,
select,
textarea {
    min-width: 0;
    max-width: 100%;
}

.sidebar-scrim,
.mobile-fab,
.admin-anchor-nav {
    display: none;
}

.wizard-form {
    display: block;
    margin-top: 22px;
}

.wizard-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0 0 26px;
    padding: 0;
    list-style: none;
}

.wizard-progress li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8b9592;
    font-size: 11px;
    font-weight: 700;
}

.wizard-progress li::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: -10px;
    left: 0;
    height: 3px;
    border-radius: 3px;
    background: #e4e9e7;
}

.wizard-progress li span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #edf1ef;
    color: #71807c;
}

.wizard-progress li.active,
.wizard-progress li.complete {
    color: var(--green);
}

.wizard-progress li.active::after,
.wizard-progress li.complete::after {
    background: var(--coral);
}

.wizard-progress li.active span,
.wizard-progress li.complete span {
    background: var(--green);
    color: white;
}

.js .wizard-step {
    display: none;
}

.js .wizard-step.active {
    display: block;
    animation: wizard-in .18s ease-out;
}

@keyframes wizard-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.step-heading > span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 39px;
    height: 39px;
    border-radius: 12px;
    background: var(--mint);
    color: var(--green);
    font-weight: 800;
}

.step-heading h3 {
    margin: 0;
    font-size: 18px;
}

.step-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.wizard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.reservation-review {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fafcfb;
}

.reservation-review > div {
    padding: 15px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.reservation-review small,
.reservation-review strong {
    display: block;
}

.reservation-review small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.reservation-review strong {
    font-size: 13px;
}

.review-note {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    background: var(--mint);
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
}

.schedule-help {
    display: block;
}

.schedule-help summary {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    cursor: pointer;
}

.schedule-help summary::-webkit-details-marker {
    display: none;
}

.schedule-help summary strong {
    font-size: 17px;
}

.schedule-help-content {
    margin-top: 16px;
}

.admin-section {
    scroll-margin-top: 90px;
}

@media (max-width: 980px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        width: min(86vw, 330px);
        padding-top: 24px;
    }

    .sidebar-scrim {
        position: fixed;
        z-index: 9;
        inset: 0;
        border: 0;
        background: rgba(7, 27, 24, .58);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s;
    }

    body.sidebar-open .sidebar-scrim {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        padding: 16px;
    }

    .topbar {
        position: sticky;
        z-index: 8;
        top: 0;
        margin: -16px -16px 18px;
        padding: 14px 16px;
        border-bottom: 1px solid rgba(223, 229, 226, .8);
        background: rgba(245, 247, 244, .96);
        backdrop-filter: blur(12px);
    }

    .menu-button {
        flex: 0 0 auto;
        box-shadow: 0 4px 14px rgba(30, 52, 47, .08);
    }

    .topbar h1 {
        font-size: clamp(20px, 5vw, 26px);
    }

    .panel {
        border-radius: 15px;
        box-shadow: 0 8px 24px rgba(30, 52, 47, .06);
    }

    .form-layout {
        display: flex;
        flex-direction: column;
    }

    .form-panel {
        order: 1;
    }

    .schedule-help {
        order: 2;
        padding: 17px 19px;
    }

    .schedule-help .info-icon {
        width: 31px;
        height: 31px;
        margin: 0;
        font-size: 15px;
    }

    .admin-anchor-nav {
        position: sticky;
        z-index: 7;
        top: 75px;
        display: flex;
        gap: 7px;
        overflow-x: auto;
        margin: 0 -16px 14px;
        padding: 3px 16px 10px;
        background: linear-gradient(var(--paper) 75%, transparent);
        scrollbar-width: none;
    }

    .admin-anchor-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-anchor-nav a {
        flex: 0 0 auto;
        padding: 9px 14px;
        border: 1px solid var(--line);
        border-radius: 99px;
        background: white;
        color: var(--green);
        font-size: 12px;
        font-weight: 750;
        text-decoration: none;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    .main {
        padding: 12px;
    }

    .topbar {
        margin: -12px -12px 14px;
        padding: 12px;
    }

    .topbar .eyebrow {
        font-size: 9px;
    }

    .stats-grid {
        gap: 9px;
        margin-bottom: 12px;
    }

    .stat-card {
        min-width: 0;
        padding: 14px;
        border-radius: 14px;
    }

    .stat-card strong {
        font-size: 22px;
    }

    .stat-card.wide strong {
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .panel {
        padding: 16px;
    }

    .panel-header h2 {
        font-size: 19px;
    }

    input,
    select,
    textarea {
        min-height: 50px;
        padding: 12px;
        font-size: 16px;
    }

    textarea {
        min-height: 88px;
    }

    .button {
        min-height: 46px;
        padding: 12px 15px;
        font-size: 13px;
    }

    .panel-header > .button.primary {
        display: none;
    }

    .filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: end;
    }

    .filters label {
        width: 100%;
        min-width: 0;
    }

    .filters input,
    .filters select,
    .filters .button {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .filters .clear-filter {
        justify-self: center;
        padding: 6px 10px;
    }

    .reservation-list {
        margin: 0 -5px;
    }

    .date-divider {
        position: sticky;
        z-index: 2;
        top: 73px;
        padding: 13px 8px 8px;
        background: white;
    }

    .reservation-row.no-action {
        grid-template-columns: 92px 1fr;
        gap: 9px;
        margin-bottom: 8px;
        padding: 13px 10px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fbfcfb;
    }

    .reservation-row .person {
        grid-column: 2;
    }

    .shift-badge {
        align-self: start;
        padding-top: 3px;
    }

    .wizard-progress {
        margin-bottom: 23px;
    }

    .wizard-progress li {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        font-size: 10px;
    }

    .wizard-progress li span {
        width: 23px;
        height: 23px;
    }

    .step-heading {
        align-items: flex-start;
    }

    .step-heading > span {
        width: 35px;
        height: 35px;
    }

    .step-heading h3 {
        font-size: 17px;
    }

    .wizard-grid,
    .reservation-review {
        grid-template-columns: minmax(0, 1fr);
    }

    .wizard-grid .full,
    .reservation-review .full {
        grid-column: 1;
    }

    .wizard-grid label,
    .wizard-grid input,
    .wizard-grid select,
    .wizard-grid textarea {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .wizard-grid input[type="date"],
    .wizard-grid input[type="time"] {
        display: block;
        inline-size: 100%;
        min-inline-size: 0;
        max-inline-size: 100%;
        -webkit-appearance: none;
        appearance: none;
    }

    .form-panel,
    .wizard-step {
        overflow: hidden;
    }

    .reservation-review > div {
        border-right: 0;
    }

    .wizard-actions {
        position: sticky;
        z-index: 4;
        bottom: 0;
        margin: 23px -16px -16px;
        padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
        border-radius: 0 0 15px 15px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -8px 18px rgba(30, 52, 47, .06);
        backdrop-filter: blur(10px);
    }

    .wizard-actions .primary {
        flex: 1;
    }

    .mobile-fab {
        position: fixed;
        z-index: 6;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 50px;
        padding: 0 18px;
        border-radius: 99px;
        background: var(--coral);
        color: white;
        box-shadow: 0 10px 25px rgba(238, 116, 93, .35);
        font-weight: 800;
        text-decoration: none;
    }

    .admin-toolbar {
        padding: 13px;
    }

    .admin-toolbar form,
    .admin-toolbar .button {
        width: 100%;
    }

    .admin-reservation-row {
        grid-template-columns: 92px 1fr;
        gap: 10px;
    }

    .resource-row {
        grid-template-columns: 38px 1fr auto;
        gap: 9px;
    }

    .history-row {
        padding: 13px 2px;
    }

    footer {
        padding-bottom: 78px;
    }
}
