/* AppointmentBoard owns these selectors; shared dialogs keep their own styles. */
.appointment-board {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overscroll-behavior-y: contain;
}

.appointment-board-header {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #f5f5f5;
    transform: translateY(3px);
}

.appointment-board-layout-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid var(--colour-border);
    border-radius: 999px;
    background: var(--colour-surface);
    color: var(--colour-text-secondary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

.appointment-board-layout-toggle[hidden] { display: none; }
.appointment-board-layout-toggle:disabled { opacity: 0.5; cursor: default; }
.appointment-board-layout-toggle:focus-visible {
    outline: 2px solid var(--colour-primary);
    outline-offset: 2px;
}
.appointment-board-toggle-track {
    display: block;
    width: 28px;
    height: 16px;
    padding: 2px;
    border-radius: 999px;
    background: #484e55;
}
.appointment-board-toggle-track::after {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f5f5f5;
}
.appointment-board-layout-toggle[aria-checked="true"] .appointment-board-toggle-track {
    background: var(--colour-primary);
}
.appointment-board-layout-toggle[aria-checked="true"] .appointment-board-toggle-track::after {
    transform: translateX(12px);
}

.appointment-board-day-button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 4px;
    border: 0;
    border-radius: 8px;
    background: #24282d;
    color: #9da3aa;
    font-size: 32px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.appointment-board-day-button:hover {
    background: #343a40;
    color: #fff;
}

.appointment-board-date-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.appointment-board-weekday { font-weight: 700; }

.appointment-board-date-input {
    min-width: 150px;
    min-height: 44px;
    padding: 8px 8px 8px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #f5f5f5;
    color-scheme: dark;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.appointment-board-date-input:hover { color: #fff; }
.appointment-board-date-input::-webkit-date-and-time-value { font: inherit; }
.appointment-board-date-input::-webkit-datetime-edit { font: inherit; }
.appointment-board-date-input:focus-visible {
    outline: 2px solid #f5f5f5;
    outline-offset: 2px;
}

.appointment-board-columns {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 12px;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #15171a;
    border-radius: 18px;
    scroll-snap-type: x mandatory;
}

.appointment-board-columns,
.appointment-board-schedule {
    color-scheme: dark;
    scrollbar-color: #4a5057 #15171a;
}

.appointment-board-staff {
    flex: 0 0 320px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1d2024;
    border: 1px solid #30353b;
    border-radius: 14px;
    scroll-snap-align: start;
}

.appointment-board-staff-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #24282d;
    border-bottom: 1px solid #343940;
    color: #f5f5f5;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.appointment-board-staff-name {
    color: var(--colour-primary);
    font-size: 18px;
    font-weight: 700;
}

.appointment-board-shift {
    flex-shrink: 0;
    color: #78a987;
    font-size: 12px;
    font-weight: 500;
}

.appointment-board-schedule {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.appointment-board-gap {
    flex: 0 0 22px;
    width: 100%;
    align-self: center;
    padding: 0;
    background: transparent;
    border: 1px solid #4a5057;
    border-radius: 11px;
    cursor: pointer;
    touch-action: manipulation;
}

.appointment-board-gap:hover {
    background: var(--colour-surface-hover);
    border-color: var(--colour-primary);
}

.appointment-board-gap:focus-visible,
.appointment-board-appointment:focus-visible,
.appointment-board-day-button:focus-visible {
    outline: 2px solid var(--colour-primary);
    outline-offset: 2px;
}

.appointment-board-current-time {
    flex: 0 0 22px;
    width: 100%;
    margin-block: -6px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--colour-warning);
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
}

.appointment-board-current-time::before,
.appointment-board-current-time::after {
    content: '';
    flex: 1;
    height: 2px;
    background: currentColor;
}

/* Background and contrasting text colours are assigned by AppointmentBoard. */
.appointment-board-appointment {
    padding: 14px 15px;
    border: 1px solid rgb(255 255 255 / 8%);
    border-radius: 12px;
    background: #343a40;
    color: #fff;
    box-shadow: 0 3px 10px rgb(0 0 0 / 18%);
}

.appointment-board-appointment-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.appointment-board-time {
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 500;
}

.appointment-board-client {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.appointment-board-notes {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    text-align: left;
}

.appointment-board-badges {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.appointment-board-badge {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.appointment-board-badge-requested { background: #d9534f; }
.appointment-board-badge-confirmed { background: #28a745; }
.appointment-board-badge-invoiced {
    background: var(--colour-primary);
    color: #07131b;
}

.appointment-board-error {
    padding: 20px;
    color: #f5f5f5;
}

@media (max-width: 700px) {
    .appointment-board-columns {
        gap: 14px;
        padding: 8px 26px;
        scroll-padding-inline: 26px;
    }

    .appointment-board-staff {
        flex-basis: calc(100vw - 52px);
        scroll-snap-align: center;
    }

    .appointment-board-schedule { padding: 14px; }
    .appointment-board-appointment { padding: 15px; }
    .appointment-board-staff-header { font-size: 16px; }
    .appointment-board-shift,
    .appointment-board-time,
    .appointment-board-notes { font-size: 14px; }
    .appointment-board-client { font-size: 17px; }
    .appointment-board-badge { font-size: 11px; }
}

/* Time-aligned presentation. The columns container is the only scroll surface;
   time-sized children overflow it together, retaining distinct staff columns. */
.appointment-board-aligned {
    --appointment-board-appointment-gap: 2px;
    --appointment-board-ruler-width: 56px;
    --appointment-board-staff-header-height: 54px;
    --appointment-board-unavailable-border: #41474f;
    --appointment-board-unavailable-background: #232d38;
}

.appointment-board-aligned .appointment-board-columns {
    align-items: flex-start;
    scroll-snap-type: none;
    padding-left: 0;
    overflow: auto;
    overscroll-behavior-y: contain;
    scroll-padding-left: calc(var(--appointment-board-ruler-width) + 24px);
}

.appointment-board-aligned .appointment-board-staff {
    min-height: 0;
    overflow: visible;
}

.appointment-board-aligned .appointment-board-staff-header {
    position: sticky;
    top: 0;
    z-index: 4;
    height: var(--appointment-board-staff-header-height);
    border-radius: 13px 13px 0 0;
}

/* Mask the scrollport's top padding and the header's rounded corners, then
   repaint the header surface above that mask. Both stay behind its text. */
.appointment-board-aligned .appointment-board-staff-header::before {
    content: '';
    position: absolute;
    inset: -14px -1px 0;
    z-index: -2;
    background: #15171a;
    pointer-events: none;
}

.appointment-board-aligned .appointment-board-staff-header::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: inherit;
    pointer-events: none;
}

.appointment-board-aligned .appointment-board-staff-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appointment-board-aligned .appointment-board-schedule {
    position: relative;
    display: block;
    flex: none;
    padding: 0;
    overflow: visible;
    border-radius: 0 0 13px 13px;
}

.appointment-board-ruler {
    --appointment-board-ruler-inset: 12px;
    position: sticky;
    left: 0;
    z-index: 5;
    /* The scroll container has no left padding in this mode. The ruler owns
       that space, keeping labels aligned while its opaque edge sticks at zero. */
    flex: 0 0 calc(var(--appointment-board-ruler-width) + var(--appointment-board-ruler-inset));
    padding-left: var(--appointment-board-ruler-inset);
    border: 1px solid transparent;
    background: #15171a;
    color: var(--colour-text-secondary);
}

.appointment-board-ruler-header {
    position: sticky;
    top: 0;
    z-index: 1;
    height: var(--appointment-board-staff-header-height);
    background: #15171a;
}

/* Keep the header-height spacer for alignment, masking ruler marks as they
   scroll through it and the padding above, just like the staff headers. */
.appointment-board-ruler-header::before {
    content: '';
    position: absolute;
    inset: -14px -1px 0 calc(-1px - var(--appointment-board-ruler-inset));
    background: #15171a;
    pointer-events: none;
}

.appointment-board-ruler-scale { position: relative; }
.appointment-board-ruler-mark { position: absolute; right: 3px; }
.appointment-board-ruler-hour {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
    transform: translateY(-50%);
}
.appointment-board-ruler-hour:first-child { transform: none; }
.appointment-board-ruler-number { font-size: 23px; font-weight: 600; }
.appointment-board-ruler-minutes { font-size: 10px; }
.appointment-board-ruler-notch {
    width: 8px;
    border-top: 1px solid #4a5057;
}
.appointment-board-ruler-half {
    width: 16px;
    border-top: 1px solid #858d96;
}

.appointment-board-unavailable,
.appointment-board-available {
    position: absolute;
    left: 8px;
    right: 8px;
    margin: 0;
    padding: 0;
    border-radius: 8px;
}

.appointment-board-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--appointment-board-unavailable-border);
    background: var(--appointment-board-unavailable-background);
    color: var(--colour-text-muted);
    font-size: 13px;
    pointer-events: none;
}

.appointment-board-available {
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}
.appointment-board-available:hover { background: rgb(59 158 216 / 7%); }
.appointment-board-available:disabled { cursor: default; }
.appointment-board-available:focus-visible {
    outline: 2px solid var(--colour-primary);
    outline-offset: -2px;
}

.appointment-board-aligned .appointment-board-appointment {
    position: absolute;
    z-index: 2;
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}
.appointment-board-appointment-content { padding: 14px 15px; }

/* Only short cards need the first row to fit in the 20px available after
   borders and the inter-appointment gap. Longer cards keep their padding. */
.appointment-board-appointment-compact .appointment-board-appointment-content {
    padding-block: 0;
}

.appointment-board-aligned .appointment-board-appointment-compact .appointment-board-time,
.appointment-board-aligned .appointment-board-appointment-compact .appointment-board-client {
    line-height: 20px;
}

.appointment-board-aligned .appointment-board-time {
    flex-shrink: 0;
    margin-bottom: 0;
    white-space: nowrap;
}

.appointment-board-aligned .appointment-board-client {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appointment-board-aligned .appointment-board-current-time {
    position: absolute;
    z-index: 3;
    left: 8px;
    width: calc(100% - 16px);
    height: 0;
    margin: 0;
}

@media (max-width: 700px) {
    .appointment-board-aligned .appointment-board-columns {
        scroll-padding-left: calc(var(--appointment-board-ruler-width) + 40px);
    }
    .appointment-board-aligned .appointment-board-staff {
        flex-basis: calc(100vw - 66px - var(--appointment-board-ruler-width));
    }
    .appointment-board-ruler { --appointment-board-ruler-inset: 26px; }
    .appointment-board-appointment-content { padding: 15px; }
}
