@import url('https://fonts.googleapis.com/css2?family=Black+Ops+One&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #101820;
  color: #f4f4f4;
  overflow-x: hidden;
}

.page-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(260px, 1fr) 280px;
    grid-template-areas:
        "legend title tools";
    align-items: center;
    gap: 14px;
    padding: 26px 16px 10px;
    text-align: center;
    background: #0b1117;
    border-bottom: 2px solid #2f3b46;
    overflow: hidden;
}

.hidden-schedule-row {
    display: none !important;
}

.vacation-calendar-view {
    margin: 8px;
    padding: 14px;
    background: #17212b;
    border: 1px solid #2f3b46;
    border-radius: 10px;
}

.vacation-calendar-view.hidden {
    display: none;
}

.vacation-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.vacation-calendar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.vacation-calendar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vacation-calendar-controls select {
    background: #111922;
    color: #ffffff;
    border: 1px solid #6b7c8f;
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: bold;
}

.vacation-calendar-title-row {
    display: grid;
    grid-template-columns: 44px minmax(280px, 360px) 44px;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.vacation-calendar-title-row h2 {
    text-align: center;
    white-space: nowrap;
}

.vacation-arrow-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.vacation-arrow-btn {
    background: #111922;
    color: #ffffff;
    border: 1px solid #6b7c8f;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
}

.vacation-arrow-btn:hover {
    background: #1f2c38;
}

.vacation-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: 6px;
}

.vacation-weekday-header {
    background: #0b1117;
    border: 1px solid #394856;
    padding: 8px;
    text-align: center;
    font-weight: bold;
    color: #d9e2ea;
}

.vacation-day-cell {
    min-height: 105px;
    background: #111922;
    border: 1px solid #394856;
    border-radius: 6px;
    padding: 6px;
}

.vacation-day-cell.empty {
    background: #0b1117;
    opacity: 0.45;
}

.vacation-day-number {
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 5px;
}

.vacation-entry {
    display: block;
    margin-top: 4px;
    padding: 3px 5px;
    border-radius: 4px;
    background: #d29922;
    color: #111111;
    font-size: 0.72rem;
    font-weight: bold;
    line-height: 1.2;
    cursor: grab;
    user-select: none;
}

    .vacation-entry.approved-yes {
        border: 2px solid #22c55e;
    }

    .vacation-entry.approved-pending {
        border: 2px dashed #facc15;
        font-style: italic;
        opacity: 0.85;
    }

    .vacation-entry.approved-no {
        border: 2px solid #ef4444;
        opacity: 0.55;
        text-decoration: line-through;
    }

    .vacation-entry.dragging {
        opacity: 0.35;
        cursor: grabbing;
    }

.vacation-day-cell.drag-over {
    outline: 2px dashed #ffffff;
    outline-offset: -4px;
}

.vacation-day-cell {
    cursor: pointer;
}

.vacation-day-cell.empty {
    cursor: default;
}

.vacation-entry-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.vacation-entry-modal.hidden {
    display: none;
}

.vacation-entry-box {
    width: 340px;
    background: #111922;
    border: 1px solid #394856;
    border-radius: 10px;
    padding: 18px;
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.vacation-entry-box h3 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.vacation-entry-box label {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    color: #d9e2ea;
    font-size: 0.8rem;
}

.vacation-entry-box input,
.vacation-entry-box select {
    width: 100%;
    padding: 8px;
    background: #0b1117;
    border: 1px solid #394856;
    border-radius: 5px;
    color: #ffffff;
}

.vacation-entry-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: #ff6b6b;
    font-size: 0.8rem;
}

.vacation-entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.vacation-entry-actions button {
    background: #1f2c38;
    color: #ffffff;
    border: 1px solid #6b7c8f;
    border-radius: 5px;
    padding: 6px 12px;
    cursor: pointer;
}

.vacation-entry-actions button:hover {
    background: #2b3947;
}

    .vacation-entry-actions .hidden {
        display: none;
    }

    .vacation-entry-actions .danger {
        margin-right: auto;
        background: #4b1111;
        border-color: #991b1b;
    }

        .vacation-entry-actions .danger:hover {
            background: #6b1717;
        }

@media (max-width: 768px) {
    .vacation-calendar-grid {
        grid-template-columns: repeat(7, minmax(70px, 1fr));
        gap: 4px;
    }

    .vacation-day-cell {
        min-height: 80px;
        padding: 4px;
        font-size: 0.75rem;
    }

    .vacation-calendar-header {
        flex-direction: column;
        align-items: center;
    }
}

.spare-schedule-row {
    display: none !important;
}

body:not(.schedule-locked) .spare-schedule-row,
.spare-schedule-row.active-spare-row {
    display: table-row !important;
}


.admin-section-label,
.officer-col {
    position: sticky;
    left: 0;
    z-index: 35;
    background: #22313f;
    min-width: 160px;
    box-shadow: 2px 0 0 #2f3b46;
}

.row-hide-btn {
    display: none;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: #3b1111;
    color: #ffffff;
    border: 1px solid #7f1d1d;
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 20;
}

body:not(.schedule-locked) .row-hide-btn {
    display: inline-block;
}

.row-hide-btn:hover {
    background: #5b1717;
}

    .page-header h1 {
        position: relative;
        z-index: 2;
        margin: 0;
        font-size: 2.2rem;
        letter-spacing: 1px;
    }

.scripture-quote {
    position: relative;
    z-index: 2;
    margin: 4px 0 0;
    font-family: 'Black Ops One', Arial, sans-serif;
    font-size: clamp(0.58rem, 0.8vw, 0.78rem);
    color: #d9e2ea;
    letter-spacing: 1px;
    white-space: normal;
    line-height: 1.2;
    text-shadow: 0 0 8px rgba(255,255,255,0.2);
}
.quarter-label {
    position: relative;
    z-index: 2;
    margin: 4px 0 0;
    color: #c7d0d9;
    font-size: 0.95rem;
}

.schedule-wrapper {
  padding: 6px 8px;
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100vw;
}

.schedule-legend {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 6px 12px;
    align-items: center;
    justify-content: start;
    color: #ffffff;
}

.header-legend-wrap {
    grid-area: legend;
    position: relative;
    z-index: 3;
    align-self: center;
    justify-self: start;
}

.header-legend {
    position: relative;
    left: auto;
    top: auto;
    max-width: none;
    justify-content: flex-start;
}

.schedule-version-note {
    position: absolute;
    left: 14px;
    top: 8px;
    margin: 0;
    padding: 0;
    font-size: 0.62rem;
    color: #8fa3b5;
    text-align: left;
    letter-spacing: 0.3px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.header-title-area {
    grid-area: title;
    position: relative;
    z-index: 2;
    min-width: 0;
    overflow: visible;
    padding: 18px 4px;
    transform: translateX(-55px);
}

.page-header h1 {
    position: relative;
    z-index: 2;
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 2.2rem);
    letter-spacing: 1px;
    line-height: 1.1;
}

.legend-item {
    display: grid;
    grid-template-columns: 44px auto;
    align-items: center;
    column-gap: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.legend-code {
    display: inline-block;
    width: 48px;
    padding: 4px 6px;
    text-align: center;
    border-radius: 4px;
    font-weight: bold;
}

.legend-label {
    color: #d9e2ea;
}




.top-scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    height: 24px;
    margin: 4px 8px 6px;
    border: 1px solid #394856;
    background: #0b1117;
    position: sticky;
    top: 0;
    z-index: 50;
    max-width: 100vw;
}

.top-scrollbar-content {
    height: 1px;
}



    .add-schedule-btn:hover {
        background: #1f2c38;
    }

.schedule-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

    .schedule-modal.hidden {
        display: none;
    }

.schedule-form-box {
    width: 360px;
    background: #111922;
    border: 1px solid #394856;
    border-radius: 10px;
    padding: 18px;
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

    .schedule-form-box h3 {
        margin: 0 0 14px;
        font-size: 1.1rem;
    }

    .schedule-form-box label {
        display: block;
        margin-top: 10px;
        margin-bottom: 4px;
        color: #d9e2ea;
        font-size: 0.8rem;
    }

    .schedule-form-box input,
    .schedule-form-box select {
        width: 100%;
        padding: 8px;
        background: #0b1117;
        border: 1px solid #394856;
        border-radius: 5px;
        color: #ffffff;
    }

.schedule-form-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: #ff6b6b;
    font-size: 0.8rem;
}

.schedule-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

    .schedule-form-actions button {
        background: #1f2c38;
        color: #ffffff;
        border: 1px solid #6b7c8f;
        border-radius: 5px;
        padding: 6px 12px;
        cursor: pointer;
    }

        .schedule-form-actions button:hover {
            background: #2b3947;
        }




    .make-changes-btn:hover {
        background: #1f2c38;
    }

.login-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

    .login-modal.hidden {
        display: none;
    }

.login-box {
    width: 320px;
    background: #111922;
    border: 1px solid #394856;
    border-radius: 10px;
    padding: 18px;
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

    .login-box h3 {
        margin: 0 0 14px;
        font-size: 1.1rem;
    }

    .login-box label {
        display: block;
        margin-top: 10px;
        margin-bottom: 4px;
        color: #d9e2ea;
        font-size: 0.8rem;
    }

    .login-box input {
        width: 100%;
        padding: 8px;
        background: #0b1117;
        border: 1px solid #394856;
        border-radius: 5px;
        color: #ffffff;
    }

.login-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: #ff6b6b;
    font-size: 0.8rem;
}

.login-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

    .login-actions button {
        background: #1f2c38;
        color: #ffffff;
        border: 1px solid #6b7c8f;
        border-radius: 5px;
        padding: 6px 12px;
        cursor: pointer;
    }

        .login-actions button:hover {
            background: #2b3947;
        }

body.schedule-locked .editable-cell {
    cursor: default;
}

.quarter-board {
    width: fit-content;
    background: #17212b;
    border: 1px solid #2f3b46;
    border-radius: 10px;
    overflow: visible;
}
.admin-section {
  border-bottom: 4px solid #0b1117;
}

.support-section {
  border-top: 4px solid #0b1117;
}

.shift-block {
  border-bottom: 3px solid #0b1117;
}

.shift-title-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 12px;
    background: #111922;
    border-bottom: 1px solid #394856;
    min-width: max-content;
}

    .shift-title-row h3,
    .shift-title-row span {
        position: sticky;
        left: 12px;
        z-index: 10;
        background: #111922;
    }

    .shift-title-row h3 {
        position: sticky;
        left: 0;
        z-index: 35;
        background: #111922;
        min-width: 160px;
        margin: 0;
        padding: 4px 8px;
    }

    .shift-title-row span {
        left: 150px;
    }

.shift-title-row h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  color: #ffffff;
}

    .shift-title-row span {
        font-size: 0.8rem;
        color: #c7d0d9;
        white-space: nowrap;
        font-weight: bold;
    }

.schedule-scroll {
  width: fit-content;
}

.calendar-pad {
    background: #0b1117 !important;
}

.schedule-table {
  border-collapse: collapse;
  width: max-content;
  table-layout: fixed;
}

    .schedule-table th,
    .schedule-table td {
        border: 1px solid #394856;
        padding: 6px 4px;
        text-align: center;
        width: 56px;
        min-width: 56px;
        max-width: 56px;
        height: 36px;
        font-size: 0.78rem;
    }
.schedule-table th {
  background: #1f2c38;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.section-month-row th {
  height: 36px;
}

.admin-section-label,
.support-section-label {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 135px !important;
  text-align: left !important;
  background: #2b3947 !important;
  color: #ffffff !important;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.95rem !important;
}

.month-span {
  background: #22303d !important;
  color: #ffffff !important;
  font-family: 'Black Ops One', Arial, sans-serif;
  font-size: 0.82rem !important;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.weekday-header-row th {
  background: #22303d !important;
  height: 28px;
  color: #aebdcc;
  font-size: 0.65rem;
}

.date-header-row th {
  background: #1f2c38 !important;
  height: 28px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: bold;
}



/* Sticky left name/section column */
.officer-name,
.admin-section-label,
.officer-col {
    position: sticky;
    left: 0;
    z-index: 40;
    min-width: 160px;
    width: 160px;
    max-width: 160px;
    background: #17212b;
    box-shadow: 2px 0 0 #2f3b46;
}

/* ADMIN header cell */
.admin-section-label {
    background: #22313f;
    text-align: left;
    padding-left: 8px;
    z-index: 45;
}

/* Blank top-left header cells under ADMIN */
.officer-col {
    background: #17212b;
    z-index: 44;
}

/* Officer name cells */
.officer-name {
    background: #17212b;
    z-index: 43;
}

/* Make shift section titles sticky on the left too */
.shift-title-row h3 {
    position: sticky;
    left: 0;
    z-index: 45;
    min-width: 160px;
    width: 160px;
    max-width: 160px;
    margin: 0;
    padding: 4px 8px;
    background: #111922;
    box-shadow: 2px 0 0 #2f3b46;
    text-align: left;
}

.name-col,
.officer-col {
  background: #111922 !important;
}

.officer-name {
  background: #18232e;
  font-weight: bold;
  color: #ffffff;
}

.schedule-table td {
  background: #111922;
  color: #d9e2ea;
}

.pay-period-divider {
    border-left: 4px solid #1d4ed8 !important;
}

.days {
    background: #16a34a !important;
    color: #ffffff !important;
    font-weight: bold;
}

.nights {
    background: #dc2626 !important;
    color: #ffffff !important;
    font-weight: bold;
}

.a-shift {
    background: #1e3a8a !important;
    color: #ffffff !important;
    font-weight: bold;
}

.ten-a-six-p {
    background: #7dd3fc !important;
    color: #111111 !important;
    font-weight: bold;
}

.b-shift {
    background: #064e3b !important;
    color: #ffffff !important;
    font-weight: bold;
}

.c-shift {
    background: #800000 !important;
    color: #ffffff !important;
    font-weight: bold;
}

.desk {
  background: #238636 !important;
  color: #ffffff !important;
  font-weight: bold;
}

.admin {
  background: #0f766e !important;
  color: #ffffff !important;
  font-weight: bold;
}

.off {
  background: #30363d !important;
  color: #c9d1d9 !important;
}

.vacation {
  background: #d29922 !important;
  color: #111111 !important;
  font-weight: bold;
}

.training {
  background: #db6d28 !important;
  color: #111111 !important;
  font-weight: bold;
}


.light-duty-days {
    background: #8fca8a !important;
    color: #102410 !important;
    font-weight: bold;
}

.light-duty-nights {
    background: #d98787 !important;
    color: #2b0d0d !important;
    font-weight: bold;
}
.sick-leave {
    background: #30363d !important;
    color: #ff4d4d !important;
    font-weight: bold;
}

.holiday {
  background: #f0f6fc !important;
  color: #111111 !important;
  font-weight: bold;
}

.shortage {
  outline: 3px solid #ff4d4d;
  outline-offset: -3px;
}

.editable-cell {
  cursor: text;
}


.title-patch-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(95px, 12vw, 150px);
    height: auto;
    opacity: 0.22;
    z-index: 1;
    pointer-events: none;
}

.header-title-area h1,
.header-title-area .scripture-quote,
.header-title-area .quarter-label {
    position: relative;
    z-index: 2;
}

.editable-cell:focus {
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  background: #263544 !important;
}

/* CURRENT DAY HIGHLIGHT - TRANSPARENT OVERLAY */

/* CURRENT DAY HIGHLIGHT - 3D RAISED COLUMN */

/* Header/date cells stay bold yellow and raised */
.schedule-table th.current-day-column {
    position: relative;
    background: #fde047 !important;
    color: #111111 !important;
    font-weight: 900 !important;
    z-index: 8 !important;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75), inset 0 -3px 0 rgba(180, 120, 0, 0.55), 0 0 0 2px #facc15, 0 4px 10px rgba(250, 204, 21, 0.35) !important;
}

/* Body cells keep shift colors, but get transparent yellow + raised edge */
.schedule-table td.current-day-column {
    position: relative;
    font-weight: bold;
    z-index: 7 !important;
    box-shadow: inset 0 0 0 9999px rgba(253, 224, 71, 0.28), inset 3px 0 0 rgba(255, 255, 255, 0.65), inset -3px 0 0 rgba(120, 85, 0, 0.45), 0 0 0 2px rgba(250, 204, 21, 0.8), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

    /* Court text readable on highlighted current day */
    .schedule-table td.current-day-column .court-schedule-code {
        color: #111111 !important;
        background: rgba(255, 255, 255, 0.82);
        border-radius: 3px;
        padding: 1px 3px;
    }

    /* Court text readable on highlighted current day */
    .schedule-table td.current-day-column .court-schedule-code {
        color: #111111 !important;
        background: rgba(255, 255, 255, 0.78);
        border-radius: 3px;
        padding: 1px 3px;
    }

/* Keep current-day header cells readable */
.schedule-table th.current-day-column {
    color: #111111 !important;
}

/* Keep shift colors/text readable under current-day overlay */
.schedule-table td.current-day-column.days,
.schedule-table td.current-day-column.nights,
.schedule-table td.current-day-column.desk,
.schedule-table td.current-day-column.admin,
.schedule-table td.current-day-column.a-shift,
.schedule-table td.current-day-column.b-shift,
.schedule-table td.current-day-column.c-shift,
.schedule-table td.current-day-column.vacation,
.schedule-table td.current-day-column.training,
.schedule-table td.current-day-column.light-duty-days,
.schedule-table td.current-day-column.light-duty-nights,
.schedule-table td.current-day-column.sick-leave,
.schedule-table td.current-day-column.ten-a-six-p {
    color: inherit;
}

/* Make court text readable on highlighted current day */
.schedule-table td.current-day-column .court-schedule-code {
    color: #111111 !important;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 3px;
    padding: 1px 3px;
}

.name-col,
.officer-col,
.officer-name,
.admin-section-label,
.support-section-label {
    position: sticky;
    left: 0;
    z-index: 9;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    text-align: left !important;
}

.officer-name,
.officer-col,
.admin-section-label,
.support-section-label {
    box-shadow: 3px 0 0 #1d4ed8;
}

.shortage-section {
    border-top: 4px solid #0b1117;
    border-bottom: 4px solid #0b1117;
}

.shortage-label {
    background: #3b1111 !important;
    color: #ffffff !important;
    font-weight: bold;
}

.shortage-summary-cell {
    background: #111922 !important;
    color: #d9e2ea !important;
    font-weight: bold;
}

.shortage-alert {
    background: #7f1d1d !important;
    color: #ffffff !important;
    font-weight: bold;
}

.schedule-toolbox {
    grid-area: tools;
    position: relative;
    z-index: 100;
    justify-self: end;
    align-self: center;
    width: 260px;
    padding: 10px;
    background: rgba(17, 25, 34, 0.96);
    border: 1px solid #6b7c8f;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    color: #ffffff;
    text-align: left;
}

.toolbox-title {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.toolbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.toolbox-row label {
    font-size: 0.75rem;
    color: #d9e2ea;
    min-width: 62px;
}

.toolbox-row select {
    flex: 1;
    background: #0b1117;
    color: #ffffff;
    border: 1px solid #6b7c8f;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-weight: bold;
}

.toolbox-btn {
    background: #111922;
    color: #ffffff;
    border: 1px solid #6b7c8f;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

.toolbox-btn:hover {
    background: #1f2c38;
}

.toolbox-btn.danger {
    background: #3b1111;
    border-color: #7f1d1d;
}

.toolbox-btn.danger:hover {
    background: #5b1717;
}

.two-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.toolbox-edit-tools {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #394856;
}

body:not(.schedule-locked) .toolbox-edit-tools {
    display: block;
}

.two-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.three-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

@media (max-width: 900px) {
    .header-title-area {
        transform: none;
    }
}

@media (max-width: 1250px) {
    .page-header {
        grid-template-columns: minmax(280px, 1fr) minmax(240px, 1fr) 260px;
        gap: 10px;
    }

    .schedule-legend {
        grid-template-columns: repeat(3, auto);
        gap: 5px 10px;
    }

    .legend-item {
        font-size: 0.66rem;
        grid-template-columns: 38px auto;
    }

    .legend-code {
        width: 38px;
        padding: 2px 4px;
    }

    .schedule-toolbox {
        width: 260px;
    }

    .page-header h1 {
        font-size: clamp(1.15rem, 1.9vw, 1.85rem);
    }
}

@media (max-width: 950px) {
    .page-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "tools";
            
        text-align: center;
        gap: 10px;
        padding: 12px 12px;
    }

    .header-legend {
    display: none;
}

    .header-legend-wrap {
        display: none;
    }

    .header-title-area {
        min-width: 0;
        padding: 10px 4px;
    }

    .schedule-toolbox {
        justify-self: center;
        width: min(300px, 95vw);
    }

    .header-legend {
        justify-content: center;
    }

}

@media (max-width: 768px) {
    .page-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "tools";
        gap: 8px;
        padding: 10px 10px 14px;
        text-align: center;
    }

    .header-title-area {
        min-width: 0;
        padding: 10px 4px;
    }

    .page-header h1 {
        font-size: 1.4rem;
        z-index: 2;
        line-height: 1.1;
    }

    .scripture-quote {
        position: relative;
        z-index: 2;
        margin: 4px 0 0;
        font-size: 0.58rem;
        white-space: normal;
        line-height: 1.2;
    }

    .quarter-label {
        font-size: 0.8rem;
    }

    .schedule-toolbox {
        justify-self: center;
        width: min(280px, 95vw);
    }

    .header-legend {
        display:none;
    }

    .schedule-legend {
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        gap: 5px 8px;
    }

    .legend-item {
        font-size: 0.64rem;
        grid-template-columns: 36px auto;
    }

    .legend-code {
        width: 36px;
        padding: 2px 4px;
    }

    .schedule-wrapper {
        padding: 10px;
    }

    .shift-title-row {
        padding: 8px 10px;
    }

    .schedule-table th,
    .schedule-table td {
        font-size: 0.7rem;
        min-width: 52px;
        padding: 5px 3px;
    }
}

/* FINAL STICKY LEFT COLUMN FIX - keep this at the very bottom */

:root {
    --sticky-name-width: 160px;
}

/* Make all left-side name/header cells one solid sticky panel */
.schedule-table .officer-name,
.schedule-table .officer-col,
.schedule-table .admin-section-label,
.schedule-table .support-section-label {
    position: sticky !important;
    left: 0 !important;
    z-index: 200 !important;
    width: var(--sticky-name-width) !important;
    min-width: var(--sticky-name-width) !important;
    max-width: var(--sticky-name-width) !important;
    background: #17212b !important;
    color: #ffffff !important;
    text-align: left !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    box-shadow: 4px 0 0 #1d4ed8, 8px 0 12px rgba(0, 0, 0, 0.35) !important;
}

/* ADMIN / SUPPORT label cells */
.schedule-table .admin-section-label,
.schedule-table .support-section-label {
    background: #22313f !important;
    font-weight: bold !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    z-index: 220 !important;
}

/* Blank top-left header cells under ADMIN */
.schedule-table .officer-col {
    background: #17212b !important;
    z-index: 210 !important;
}

/* Officer name cells */
.schedule-table .officer-name {
    background: #17212b !important;
    font-weight: bold !important;
    z-index: 205 !important;
}

    /* Make the Hide button stay visible inside the sticky name column */
    .schedule-table .officer-name .row-hide-btn {
        z-index: 230 !important;
    }

/* Sticky shift title label on the left */
.shift-title-row h3 {
    position: sticky !important;
    left: 0 !important;
    z-index: 220 !important;
    width: var(--sticky-name-width) !important;
    min-width: var(--sticky-name-width) !important;
    max-width: var(--sticky-name-width) !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    background: #111922 !important;
    color: #ffffff !important;
    text-align: left !important;
    box-shadow: 4px 0 0 #1d4ed8, 8px 0 12px rgba(0, 0, 0, 0.35) !important;
}

/* Keep shift time just to the right of the sticky title */
.shift-title-row span {
    position: sticky !important;
    left: calc(var(--sticky-name-width) + 12px) !important;
    z-index: 210 !important;
    background: #111922 !important;
}


/* STRONGER LEFT COLUMN BACKGROUND FIX */
.schedule-scroll {
    background: linear-gradient( to right, #17212b 0, #17212b 160px, transparent 160px );
}

/* FINAL FIX FOR STICKY COLUMN BLEED-THROUGH */

/* Sticky table cells behave much better with separate borders */
.schedule-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

    /* Lock every left-side sticky cell to the same exact width */
    .schedule-table .officer-name,
    .schedule-table .officer-col,
    .schedule-table .admin-section-label,
    .schedule-table .support-section-label {
        position: sticky !important;
        left: 0 !important;
        z-index: 500 !important;
        width: 170px !important;
        min-width: 170px !important;
        max-width: 170px !important;
        background: #17212b !important;
        background-clip: padding-box !important;
        color: #ffffff !important;
        text-align: left !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        border-right: 4px solid #1d4ed8 !important;
        box-shadow: 8px 0 12px rgba(0, 0, 0, 0.45) !important;
    }

    /* ADMIN / SUPPORT header label cells */
    .schedule-table .admin-section-label,
    .schedule-table .support-section-label {
        background: #22313f !important;
        z-index: 520 !important;
        font-weight: bold !important;
        letter-spacing: 1px !important;
        text-transform: uppercase !important;
    }

    /* Blank top-left cells under ADMIN */
    .schedule-table .officer-col {
        background: #17212b !important;
        z-index: 510 !important;
    }

    /* Officer name cells */
    .schedule-table .officer-name {
        background: #17212b !important;
        z-index: 505 !important;
        font-weight: bold !important;
    }

    /* Stop schedule cells from visually bleeding through the sticky column edge */
    .schedule-table td:not(.officer-name),
    .schedule-table th:not(.officer-col):not(.admin-section-label):not(.support-section-label) {
        position: relative;
        z-index: 1;
    }

/* Sticky shift section labels */
.shift-title-row h3 {
    position: sticky !important;
    left: 0 !important;
    z-index: 520 !important;
    width: 170px !important;
    min-width: 170px !important;
    max-width: 170px !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    background: #111922 !important;
    color: #ffffff !important;
    text-align: left !important;
    border-right: 4px solid #1d4ed8 !important;
    box-shadow: 8px 0 12px rgba(0, 0, 0, 0.45) !important;
}

/* Keep the shift time beside the sticky title */
.shift-title-row span {
    position: sticky !important;
    left: 185px !important;
    z-index: 510 !important;
    background: #111922 !important;
}

/* FINAL SPARE / HIDDEN ROW VISIBILITY FIX */

/* Default: spare rows stay hidden unless active or intentionally revealed */
body:not(.schedule-locked) .spare-schedule-row {
    display: none !important;
}

/* Rows with real names stay visible */
.spare-schedule-row.active-spare-row {
    display: table-row !important;
}

/* Temporary reveal button shows all spare/hidden rows */
body.show-hidden-rows .spare-schedule-row {
    display: table-row !important;
}

/* Saved hidden rows stay hidden unless temporary reveal is on */
.schedule-table tr.hidden-schedule-row {
    display: none !important;
}

body.show-hidden-rows .schedule-table tr.hidden-schedule-row {
    display: table-row !important;
}

/* PERSONNEL MANAGER */

.personnel-form-box select {
    width: 100%;
    padding: 8px;
    background: #0b1117;
    border: 1px solid #394856;
    border-radius: 5px;
    color: #ffffff;
}

.personnel-form-box label input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

#personnel-delete-btn {
    margin-right: auto;
    background: #4b1111;
    border-color: #991b1b;
}

    #personnel-delete-btn:hover {
        background: #6b1717;
    }

/* FINAL PERSONNEL / SPARE ROW VISIBILITY OVERRIDE */

/* Default: spare rows are hidden */
.schedule-table tr.spare-schedule-row,
body:not(.schedule-locked) .schedule-table tr.spare-schedule-row {
    display: none !important;
}

    /* Active personnel rows must show, even in locked mode */
    .schedule-table tr.spare-schedule-row.active-spare-row,
    body:not(.schedule-locked) .schedule-table tr.spare-schedule-row.active-spare-row {
        display: table-row !important;
    }

        /* Hidden rows still stay hidden unless Show Hidden Rows is active */
        .schedule-table tr.hidden-schedule-row,
        body:not(.schedule-locked) .schedule-table tr.hidden-schedule-row,
        .schedule-table tr.spare-schedule-row.active-spare-row.hidden-schedule-row {
            display: none !important;
        }

/* Show Hidden Rows temporarily reveals them */
body.show-hidden-rows .schedule-table tr.spare-schedule-row,
body.show-hidden-rows .schedule-table tr.hidden-schedule-row {
    display: table-row !important;
}

/* HELP MODAL */

.help-form-box {
    width: min(620px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
}

.help-content {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.35;
}

    .help-content h4 {
        margin: 14px 0 4px;
        color: #facc15;
    }

    .help-content p {
        margin: 4px 0 8px;
        color: #e5e7eb;
    }

@media (max-width: 1250px) {
    .header-title-area {
        transform: none !important;
        justify-self: center;
        width: 100%;
        text-align: center;
    }

    .title-patch-bg {
        left: 50%;
    }
}

/* FINAL RESPONSIVE HEADER LAYOUT */
/* Small screens: title left, toolbox right */

@media (max-width: 950px) {
    .page-header {
        grid-template-columns: minmax(0, 1fr) minmax(230px, 300px) !important;
        grid-template-areas: "title tools" !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 10px 12px !important;
        text-align: left !important;
    }

    .header-legend {
        display: none !important;
    }

    .header-title-area {
        grid-area: title !important;
        justify-self: start !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 8px 4px !important;
        text-align: left !important;
        transform: none !important;
    }

    .page-header h1 {
        text-align: left !important;
        font-size: clamp(1.25rem, 3vw, 1.8rem) !important;
        line-height: 1.1 !important;
    }

    .scripture-quote,
    .quarter-label {
        text-align: left !important;
    }

    .schedule-toolbox {
        grid-area: tools !important;
        justify-self: end !important;
        align-self: center !important;
        width: min(300px, 42vw) !important;
    }

    .title-patch-bg {
        left: 50% !important;
        opacity: 0.18 !important;
    }
}

/* Extra-small screens: keep title left / toolbox right, but make toolbox tighter */
@media (max-width: 600px) {
    .page-header {
        grid-template-columns: minmax(0, 1fr) minmax(165px, 210px) !important;
        gap: 6px !important;
        padding: 8px !important;
    }

        .page-header h1 {
            font-size: 1.05rem !important;
            letter-spacing: 0.5px !important;
        }

    .scripture-quote {
        display: none !important;
    }

    .quarter-label {
        font-size: 0.72rem !important;
    }

    .schedule-toolbox {
        width: 100% !important;
        padding: 7px !important;
        border-radius: 8px !important;
    }

    .toolbox-title {
        font-size: 0.72rem !important;
        margin-bottom: 4px !important;
    }

    .toolbox-row {
        gap: 4px !important;
        margin-top: 4px !important;
    }

        .toolbox-row label {
            display: none !important;
        }

        .toolbox-row select {
            font-size: 0.72rem !important;
            padding: 5px 6px !important;
        }

    .toolbox-btn {
        font-size: 0.7rem !important;
        padding: 5px 6px !important;
    }
}

.leave-cell-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
}

.leave-main-code {
    font-weight: bold;
}

.leave-original-code {
    margin-top: 2px;
    font-size: 0.62rem;
    opacity: 0.9;
    text-decoration: line-through;
}

/* VACATION CALENDAR TODAY HIGHLIGHT */

.vacation-day-cell.vacation-today {
    background: #fef3c7 !important;
    border: 3px solid #facc15 !important;
    color: #111111 !important;
}

    .vacation-day-cell.vacation-today .vacation-day-number {
        color: #111111 !important;
        font-weight: bold;
    }

    .vacation-day-cell.vacation-today .vacation-entry {
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    }

/* VACATION CALENDAR ENTRY COLORS - MATCH SHIFT SCHEDULE */

.vacation-entry.vacation,
.vacation-entry.sick-leave,
.vacation-entry.training,
.vacation-entry.holiday,
.vacation-entry.off {
    font-weight: bold;
}

.vacation-entry.sick-leave {
    background: #30363d !important;
    color: #ff4d4d !important;
}

.vacation-entry.light-duty-days {
    background: #8fca8a !important;
    color: #102410 !important;
}

.vacation-entry.light-duty-nights {
    background: #d98787 !important;
    color: #2b0d0d !important;
}

.vacation-entry.vacation {
    background: #d29922 !important;
    color: #111111 !important;
}

.vacation-entry.training {
    background: #db6d28 !important;
    color: #111111 !important;
}

.vacation-entry.holiday {
    background: #f0f6fc !important;
    color: #111111 !important;
}

.vacation-entry.off {
    background: #30363d !important;
    color: #c9d1d9 !important;
}

/* PARTIAL LEAVE FIELDS */

.partial-leave-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 12px !important;
    color: #ffffff !important;
    font-weight: bold;
}

    .partial-leave-checkbox-label input {
        width: auto !important;
    }

.partial-leave-time-fields {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #394856;
    border-radius: 6px;
    background: #0b1117;
}

    .partial-leave-time-fields.hidden {
        display: none;
    }

/* PARTIAL LEAVE DISPLAY ON SHIFT SCHEDULE */

.partial-leave-code {
    margin-top: 2px;
    font-size: 0.58rem;
    line-height: 1;
    font-weight: bold;
    color: #111111;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 3px;
    padding: 1px 3px;
}


.partial-leave-code.partial-sick-leave-code {
    color: #111111;
}

.partial-leave-code.partial-sick-leave-code .partial-leave-type-label {
    color: #ff4d4d;
    font-weight: 900;
}

.partial-leave-code.partial-sick-leave-code .partial-leave-time-label {
    color: #111111;
}

/* VACATION HEADER SHIFT/SCHEDULE TOGGLE */

.schedule-view-toggle-btn {
    width: auto !important;
    min-width: 170px;
    padding: 7px 14px !important;
    align-self: center;
    white-space: nowrap;
}

.vacation-calendar-header {
    align-items: center;
}

#import-backup-file-input.hidden {
    display: none;
}

/* PERSONNEL PATTERN OVERRIDE FIELDS */

.personnel-form-divider {
    border: none;
    border-top: 1px solid #394856;
    margin: 14px 0 10px;
}

.personnel-pattern-override-fields {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #394856;
    border-radius: 6px;
    background: #0b1117;
}

    .personnel-pattern-override-fields.hidden {
        display: none;
    }

/* NEW SCHEDULE PERSONNEL FIELDS */

.schedule-form-box {
    max-height: 90vh;
    overflow-y: auto;
}

.new-schedule-personnel-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #394856;
}

    .new-schedule-personnel-section h4 {
        margin: 0 0 4px;
        color: #ffffff;
        font-size: 0.95rem;
    }

.new-schedule-personnel-note {
    margin: 0 0 10px;
    color: #9fb0bf;
    font-size: 0.75rem;
    line-height: 1.3;
}

.new-schedule-personnel-group {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #394856;
    border-radius: 6px;
    background: #0b1117;
}

    .new-schedule-personnel-group h5 {
        margin: 0 0 8px;
        color: #d9e2ea;
        font-size: 0.85rem;
        border-bottom: 1px solid #263544;
        padding-bottom: 4px;
    }

    .new-schedule-personnel-group label {
        margin-top: 8px;
    }

/* NEW SCHEDULE PERSONNEL ACTION BUTTONS */

.new-schedule-personnel-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 10px 0 12px;
}

    .new-schedule-personnel-actions button {
        background: #1f2c38;
        color: #ffffff;
        border: 1px solid #6b7c8f;
        border-radius: 5px;
        padding: 7px 10px;
        cursor: pointer;
        font-weight: bold;
        font-size: 0.78rem;
    }

        .new-schedule-personnel-actions button:hover {
            background: #2b3947;
        }

/* PRINT / PDF BID SHEET - PRINT ALL MONTHS WITH NAMES */

#print-schedule-area {
    display: none;
}

@media print {
    @page {
        size: letter landscape;
        margin: 0.25in;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

        body > *:not(#print-schedule-area) {
            display: none !important;
        }

    #print-schedule-area {
        display: block !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    .print-schedule-page {
        page-break-after: always;
        break-after: page;
        background: #ffffff !important;
        color: #000000 !important;
    }

        .print-schedule-page:last-child {
            page-break-after: auto;
            break-after: auto;
        }

    .print-page-title {
        text-align: center;
        margin-bottom: 4px;
        color: #000000 !important;
    }

        .print-page-title h1 {
            margin: 0;
            font-size: 14pt;
            line-height: 1;
            color: #000000 !important;
        }

        .print-page-title div {
            margin-top: 2px;
            font-size: 8pt;
            color: #000000 !important;
        }

    .print-schedule-table {
        width: auto !important;
        max-width: none !important;
        border-collapse: collapse;
        table-layout: fixed;
        font-size: 7pt;
        line-height: 1.05;
        color: #000000 !important;
        background: #ffffff !important;
    }

        .print-schedule-table th,
        .print-schedule-table td {
            border: 1px solid #000000 !important;
            padding: 3px 1px !important;
            height: 22px !important;
            min-height: 22px !important;
            max-height: 22px !important;
            overflow: hidden !important;
            text-align: center;
            color: #000000 !important;
        }

    .print-name-cell {
        width: 105px !important;
        min-width: 105px !important;
        max-width: 105px !important;
        text-align: left !important;
        font-weight: bold !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    .print-month-cell {
        text-align: center !important;
        font-weight: bold !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    .leave-cell-display,
    .leave-main-code,
    .leave-original-code,
    .partial-leave-code {
        font-size: 6pt !important;
        line-height: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .row-hide-btn {
        display: none !important;
    }

    .print-section-row {
        text-align: left !important;
        font-weight: bold !important;
        background: #e5e5e5 !important;
        color: #000000 !important;
    }

    .print-schedule-table .days,
    .print-schedule-table .nights,
    .print-schedule-table .desk,
    .print-schedule-table .admin,
    .print-schedule-table .off,
    .print-schedule-table .sick-leave,
    .print-schedule-table .vacation,
    .print-schedule-table .training,
    .print-schedule-table .light-duty-days,
    .print-schedule-table .light-duty-nights,
    .print-schedule-table .holiday,
    .print-schedule-table .a-shift,
    .print-schedule-table .b-shift,
    .print-schedule-table .c-shift,
    .print-schedule-table .ten-a-six-p {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .print-schedule-table td.light-duty-days,
    .print-schedule-table td.light-duty-nights {
        color: #111111 !important;
    }

    /* Make printed shift-code cells easier to read */
    .print-schedule-table td.days,
    .print-schedule-table td.nights,
    .print-schedule-table td.desk,
    .print-schedule-table td.admin,
    .print-schedule-table td.off,
    .print-schedule-table td.sick-leave,
    .print-schedule-table td.vacation,
    .print-schedule-table td.training,
    .print-schedule-table td.light-duty-days,
    .print-schedule-table td.light-duty-nights,
    .print-schedule-table td.holiday,
    .print-schedule-table td.a-shift,
    .print-schedule-table td.b-shift,
    .print-schedule-table td.c-shift,
    .print-schedule-table td.ten-a-six-p {
        color: #ffffff !important;
        font-weight: bold !important;
    }

    /* Keep crossed-out/original shift text readable too */
    .print-schedule-table .leave-main-code,
    .print-schedule-table .leave-original-code,
    .print-schedule-table .partial-leave-code {
        color: #ffffff !important;
        font-weight: bold !important;
    }

    .print-schedule-table th:not(.print-name-cell),
    .print-schedule-table td:not(.print-name-cell) {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
    }

    /* Print pay-period divider lines */
    .print-schedule-table th.pay-period-divider,
    .print-schedule-table td.pay-period-divider {
        border-left: 3px solid #1d4ed8 !important;
    }
}

/* VIEWER SCHEDULE ZOOM CONTROLS */

.schedule-zoom-row {
    display: grid;
    grid-template-columns: 30px minmax(36px, 1fr) 34px 32px 28px 28px;
    gap: 3px;
    align-items: center;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.header-toggle-btn {
    font-size: 0.8rem !important;
    padding: 5px 6px !important;
}

.theme-mini-btn {
    font-size: 0.78rem !important;
    padding: 5px 6px !important;
}

.zoom-btn {
    padding: 5px 6px !important;
    font-size: 0.75rem !important;
    min-width: 0;
}

.schedule-zoom-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #d9e2ea;
    text-align: center;
}

/* VIEWER SCHEDULE ZOOM - SCALE THE FULL QUARTER BOARD */

.schedule-wrapper .quarter-board {
    zoom: var(--schedule-view-zoom, 1);
}

/* COMPACT HEADER WHEN SCHEDULE IS ZOOMED OUT */

body.schedule-zoomed-out .page-header {
    padding: 6px 10px;
    gap: 8px;
}

body.schedule-zoomed-out .header-title-area {
    padding: 6px 4px;
    transform: translateX(-35px);
}

body.schedule-zoomed-out .page-header h1 {
    font-size: clamp(1rem, 1.45vw, 1.55rem);
}

body.schedule-zoomed-out .scripture-quote {
    font-size: 0.58rem;
    margin-top: 2px;
}

body.schedule-zoomed-out .quarter-label {
    font-size: 0.72rem;
    margin-top: 2px;
}

body.schedule-zoomed-out .schedule-legend {
    gap: 3px 8px;
}

body.schedule-zoomed-out .legend-item {
    font-size: 0.68rem;
}

body.schedule-zoomed-out .legend-code {
    width: 38px;
    padding: 2px 4px;
}

body.schedule-zoomed-out .schedule-version-note {
    display: none;
}

body.schedule-zoomed-out .schedule-toolbox {
    padding: 6px;
}

body.schedule-zoomed-out .toolbox-row {
    margin-top: 5px;
}

body.schedule-zoomed-out .toolbox-btn,
body.schedule-zoomed-out .schedule-toolbox select {
    padding: 4px 6px;
    font-size: 0.72rem;
}

/* Extra compact when zoomed way out */
body.schedule-zoomed-way-out .header-legend-wrap {
    display: none;
}

body.schedule-zoomed-way-out .scripture-quote {
    display: none;
}

body.schedule-zoomed-way-out .page-header {
    grid-template-columns: 1fr 250px;
    grid-template-areas: "title tools";
}

body.schedule-zoomed-way-out .header-title-area {
    transform: none;
    padding: 4px;
}

/* LIGHT MODE */

body.light-mode {
    background: #f3f5f7;
    color: #111827;
}

    body.light-mode .page-header {
        background: #e5e9ef;
        border-bottom-color: #9ca3af;
    }

    body.light-mode .schedule-wrapper {
        background: #f3f5f7;
    }

    body.light-mode .top-scrollbar {
        background: #e5e9ef;
        border-color: #9ca3af;
    }

    body.light-mode .schedule-toolbox,
    body.light-mode .schedule-form-box,
    body.light-mode .login-box,
    body.light-mode .vacation-entry-box,
    body.light-mode .personnel-form-box {
        background: #ffffff;
        color: #111827;
        border-color: #9ca3af;
    }

        body.light-mode .toolbox-title,
        body.light-mode .schedule-toolbox label,
        body.light-mode .schedule-version-note,
        body.light-mode .quarter-label,
        body.light-mode .scripture-quote,
        body.light-mode .legend-label {
            color: #374151;
        }

        body.light-mode .toolbox-btn,
        body.light-mode .schedule-toolbox select,
        body.light-mode .schedule-form-box input,
        body.light-mode .schedule-form-box select,
        body.light-mode .login-box input,
        body.light-mode .vacation-entry-box input,
        body.light-mode .vacation-entry-box select,
        body.light-mode .personnel-form-box input,
        body.light-mode .personnel-form-box select {
            background: #f9fafb;
            color: #111827;
            border-color: #6b7280;
        }

            body.light-mode .toolbox-btn:hover {
                background: #e5e7eb;
            }

    body.light-mode .schedule-table th,
    body.light-mode .schedule-table td {
        border-color: #9ca3af;
    }

    body.light-mode .officer-col,
    body.light-mode .officer-name,
    body.light-mode .admin-section-label {
        background: #d8dee6;
        color: #111827;
        box-shadow: 2px 0 0 #9ca3af;
    }

    body.light-mode .month-span,
    body.light-mode .weekday-cell,
    body.light-mode .date-cell {
        background: #cbd5e1;
        color: #111827;
    }

    body.light-mode .vacation-calendar-view {
        background: #ffffff;
        border-color: #9ca3af;
    }

    body.light-mode .vacation-weekday-header {
        background: #d8dee6;
        color: #111827;
        border-color: #9ca3af;
    }

    body.light-mode .vacation-day-cell {
        background: #f9fafb;
        border-color: #cbd5e1;
    }

        body.light-mode .vacation-day-cell.empty {
            background: #e5e7eb;
        }

    body.light-mode .vacation-day-number {
        color: #111827;
    }

    /* Keep shift-code colors the same in light mode */
    body.light-mode .days,
    body.light-mode .nights,
    body.light-mode .desk,
    body.light-mode .admin,
    body.light-mode .off,
    body.light-mode .sick-leave,
    body.light-mode .vacation,
    body.light-mode .training,
    body.light-mode .light-duty-days,
    body.light-mode .light-duty-nights,
    body.light-mode .holiday,
    body.light-mode .a-shift,
    body.light-mode .b-shift,
    body.light-mode .c-shift,
    body.light-mode .ten-a-six-p {
        color: inherit;
    }

    /* STRONGER LIGHT MODE FOR SCHEDULE AREA */

    body.light-mode .schedule-wrapper {
        background: #eef2f7;
    }

    body.light-mode .schedule-table {
        background: #ffffff;
    }

        body.light-mode .schedule-table th,
        body.light-mode .schedule-table td {
            border-color: #94a3b8;
        }

    body.light-mode .month-span {
        background: #cbd5e1 !important;
        color: #111827 !important;
    }

    body.light-mode .weekday-cell,
    body.light-mode .date-cell {
        background: #e2e8f0 !important;
        color: #111827 !important;
    }

    body.light-mode .officer-col,
    body.light-mode .officer-name,
    body.light-mode .admin-section-label {
        background: #d8dee6 !important;
        color: #111827 !important;
        box-shadow: 2px 0 0 #94a3b8 !important;
    }

    body.light-mode .section-row td,
    body.light-mode .team-header-row td,
    body.light-mode .section-label {
        background: #cbd5e1 !important;
        color: #111827 !important;
    }

    /* Non-coded/blank cells */
    body.light-mode .schedule-table td:not(.days):not(.nights):not(.desk):not(.admin):not(.off):not(.sick-leave):not(.vacation):not(.training):not(.light-duty-days):not(.light-duty-nights):not(.holiday):not(.a-shift):not(.b-shift):not(.c-shift):not(.ten-a-six-p):not(.officer-name),
    body.light-mode .schedule-table th {
        background-color: #f8fafc;
        color: #111827;
    }

    /* Keep shift-code cells readable in light mode */
    body.light-mode .days,
    body.light-mode .nights,
    body.light-mode .desk,
    body.light-mode .admin,
    body.light-mode .off,
    body.light-mode .sick-leave,
    body.light-mode .vacation,
    body.light-mode .training,
    body.light-mode .light-duty-days,
    body.light-mode .light-duty-nights,
    body.light-mode .holiday,
    body.light-mode .a-shift,
    body.light-mode .b-shift,
    body.light-mode .c-shift,
    body.light-mode .ten-a-six-p {
        font-weight: bold;
    }

/* DISCREET VERSION LOGO MARK */

.version-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    opacity: 0.75;
    vertical-align: middle;
    margin-right: 6px;
}

/* COLLAPSE HEADER / TOOLBOX - KEEP ONLY ARROW VISIBLE */

body.header-collapsed .page-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 3px 8px;
    min-height: 0;
    height: auto;
}

body.header-collapsed .header-legend-wrap,
body.header-collapsed .header-title-area {
    display: none !important;
}

/* Shrink toolbox down to only the arrow */
body.header-collapsed .schedule-toolbox {
    width: auto;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
}

    /* Hide every toolbox item except the row containing the arrow */
    body.header-collapsed .schedule-toolbox > *:not(.schedule-zoom-row) {
        display: none !important;
    }

/* Inside the zoom row, hide everything except the header toggle arrow */
body.header-collapsed .schedule-zoom-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 0;
    gap: 5px;
}

    body.header-collapsed .schedule-zoom-row > * {
        display: none !important;
    }

body.header-collapsed #schedule-zoom-out-btn,
body.header-collapsed #schedule-zoom-label,
body.header-collapsed #schedule-zoom-in-btn,
body.header-collapsed #header-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

body.header-collapsed #schedule-zoom-label {
    min-width: 42px;
    height: 26px;
}

body.header-collapsed #schedule-zoom-out-btn,
body.header-collapsed #schedule-zoom-in-btn,
body.header-collapsed #header-toggle-btn {
    width: 34px;
    height: 26px;
    padding: 2px 6px !important;
    font-size: 0.85rem !important;
    border-radius: 6px;
}

/* Keep version note visible when header is collapsed */

body.header-collapsed .schedule-version-note {
    display: flex !important;
    align-items: center;
    gap: 5px;
    position: absolute;
    left: 8px;
    top: 4px;
    margin: 0;
    padding: 0;
    font-size: 0.62rem;
    color: #8fa3b5;
    white-space: nowrap;
    z-index: 50;
}

body.header-collapsed .version-logo-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.75;
}

/* PARTIAL LEAVE TIME INPUT NOTE */

.partial-leave-time-note {
    margin: 6px 0 0;
    color: #9fb0bf;
    font-size: 0.72rem;
    line-height: 1.25;
}

body.light-mode .partial-leave-time-note {
    color: #475569;
}

/* SHORTAGE ROW LINE BREAKS */

/* SHORTAGE ROW LINE BREAKS - KEEP EACH ENTRY ON ONE LINE */

#shortage-summary-row .shortage-summary-cell {
    white-space: pre !important;
    line-height: 1.05 !important;
    vertical-align: middle !important;
    font-size: 0.62rem !important;
    padding: 1px 0 !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}

/* LAPTOP HEADER FIX - PREVENT QUOTE / LEGEND OVERLAP */

@media (max-width: 1500px) {
    .scripture-quote {
        display: none;
    }

    .header-title-area {
        padding: 8px 4px;
        transform: translateX(-25px);
    }

    .page-header h1 {
        font-size: clamp(1.15rem, 1.6vw, 1.65rem);
    }

    .quarter-label {
        font-size: 0.8rem;
        margin-top: 2px;
    }

    .schedule-legend {
        gap: 4px 8px;
    }

    .legend-item {
        font-size: 0.72rem;
    }

    .legend-code {
        width: 42px;
        padding: 3px 5px;
    }
}

/* VACATION CALENDAR HOLIDAY LABELS */

.vacation-holiday-label {
    display: inline-block;
    margin-bottom: 5px;
    padding: 2px 5px;
    border-radius: 4px;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: bold;
    line-height: 1.15;
}

body.light-mode .vacation-holiday-label {
    background: #2563eb;
    color: #ffffff;
}

/* COURT ENTRIES */

.court-entry {
    display: block;
    margin-top: 4px;
    padding: 3px 5px;
    border-radius: 4px;
    background: #334155;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid #94a3b8;
}

.court-entry.cancelled {
    opacity: 0.55;
    text-decoration: line-through;
    border-style: dashed;
    background: #7f1d1d;
}

body.light-mode .court-entry {
    background: #475569;
    color: #ffffff;
}

body.light-mode .court-entry.cancelled {
    background: #991b1b;
}

/* COURT DISPLAY ON SHIFT SCHEDULE */

.court-schedule-code {
    margin-top: 1px;
    font-size: 0.58rem;
    line-height: 1;
    color: #ffffff;
    font-weight: bold;
    opacity: 0.95;
}

body.light-mode .court-schedule-code {
    color: #ffffff;
}

/* VACATION CALENDAR MIDDLE ACTION BUTTONS */

.vacation-middle-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.court-calendar-btn {
    min-width: 100px;
}

/* EXPANDING TOOLBOX EDIT MODE */

.schedule-toolbox {
    transition: width 0.25s ease, padding 0.25s ease;
}

/* Hide title area while unlocked so the toolbox can expand into that space */
body:not(.schedule-locked) .header-title-area {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Keep header height stable */
body:not(.schedule-locked) .page-header {
    min-height: 285px;
}

/* Expand the actual toolbox leftward */
body:not(.schedule-locked) .schedule-toolbox {
    position: relative !important;
    width: min(980px, calc(100vw - 340px)) !important;
    min-height: 265px;
    overflow: hidden;
}

    /* Keep the normal viewer controls on the right side of the expanded toolbox */
    body:not(.schedule-locked) .schedule-toolbox > .toolbox-title,
    body:not(.schedule-locked) .schedule-toolbox > .toolbox-row:not(.toolbox-edit-tools .toolbox-row) {
        width: 250px;
        margin-left: auto;
    }

/* The edit tools now live INSIDE the expanded toolbox border */
body:not(.schedule-locked) .toolbox-edit-tools {
    display: grid !important;
    position: absolute !important;
    left: 10px;
    top: 22px;
    width: calc(100% - 285px);
    padding: 8px;
    margin: 0;
    border-top: none;
    border-right: 1px solid #394856;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "schedule hidden"
        "start start"
        "end end"
        "personnel print"
        "backup backup";
    gap: 7px 10px;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.2s ease, transform 0.25s ease;
}
    /* Exact edit-tool placement inside expanded toolbox */

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(1) {
        grid-area: schedule;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(2) {
        grid-area: start;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(3) {
        grid-area: end;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(4) {
        grid-area: hidden;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(5) {
        grid-area: personnel;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(6) {
        grid-area: print;
    }

    body:not(.schedule-locked) .toolbox-edit-tools > .toolbox-row:nth-child(7) {
        grid-area: backup;
    }

    /* Arrange expanded edit tools into a cleaner vertical layout */

    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-row {
        margin: 0;
    }

    body:not(.schedule-locked) .toolbox-edit-tools .two-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-btn {
        padding: 7px 8px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Compact rows inside expanded toolbox */
    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-row {
        margin: 0;
    }

    /* Keep paired buttons side-by-side */
    body:not(.schedule-locked) .toolbox-edit-tools .two-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    /* Compact edit buttons */
    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-btn {
        padding: 6px 8px;
        font-size: 0.74rem;
        white-space: nowrap;
    }

/* Light mode */
body.light-mode:not(.schedule-locked) .toolbox-edit-tools {
    border-right-color: #94a3b8;
}

body:not(.schedule-locked) .toolbox-edit-tools .two-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

body:not(.schedule-locked) .toolbox-edit-tools .three-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

/* ARCHIVES MODAL */

.archives-form-box {
    width: min(720px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
}

.archives-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.archive-list-item {
    padding: 10px;
    border: 1px solid #394856;
    border-radius: 8px;
    background: #0b1117;
    text-align: left;
}

.archive-list-title {
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 4px;
}

.archive-list-detail {
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.archive-list-id {
    margin-top: 5px;
    font-size: 0.68rem;
    color: #8fa3b5;
    word-break: break-all;
}

.archive-list-empty {
    padding: 12px;
    color: #cbd5e1;
    text-align: center;
    border: 1px dashed #394856;
    border-radius: 8px;
}

body.light-mode .archive-list-item {
    background: #f8fafc;
    border-color: #94a3b8;
}

body.light-mode .archive-list-title {
    color: #111827;
}

body.light-mode .archive-list-detail,
body.light-mode .archive-list-empty {
    color: #334155;
}

body.light-mode .archive-list-id {
    color: #64748b;
}

/* ARCHIVED SCHEDULE VIEW MODE */

body.archive-view-mode .make-changes-btn,
body.archive-view-mode #add-court-entry-btn,
body.archive-view-mode #middle-add-court-entry-btn,
body.archive-view-mode #archive-schedule-btn,
body.archive-view-mode #import-backup-btn {
    display: none !important;
}

body.archive-view-mode #return-current-schedule-btn {
    display: block !important;
}

body.archive-view-mode .page-header {
    border-bottom-color: #facc15;
}

body.archive-view-mode .schedule-version-note::after {
    content: "  |  ARCHIVED VIEW";
    color: #facc15;
    font-weight: bold;
}

body.archive-view-mode .editable-cell {
    cursor: default !important;
}

.hidden {
    display: none !important;
}

.archive-list-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

    .archive-list-actions .toolbox-btn {
        width: auto;
        min-width: 120px;
        padding: 6px 12px;
    }

/* FINAL OVERRIDE - HEADER COLLAPSE MUST WIN OVER EXPANDED EDIT TOOLBOX */

body.header-collapsed .page-header {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    padding: 3px 8px !important;
    min-height: 0 !important;
    height: auto !important;
}

body.header-collapsed .header-legend-wrap,
body.header-collapsed .header-title-area {
    display: none !important;
}

/* Force the expanded toolbox to collapse back down */
body.header-collapsed .schedule-toolbox {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

    /* Hide everything in toolbox except the zoom/arrow row */
    body.header-collapsed .schedule-toolbox > *:not(.schedule-zoom-row) {
        display: none !important;
    }

/* Keep only zoom out, label, zoom in, and restore arrow visible */
body.header-collapsed .schedule-zoom-row {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    gap: 5px !important;
    width: auto !important;
}

    body.header-collapsed .schedule-zoom-row > * {
        display: none !important;
    }

body.header-collapsed #schedule-zoom-out-btn,
body.header-collapsed #schedule-zoom-label,
body.header-collapsed #schedule-zoom-in-btn,
body.header-collapsed #header-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.header-collapsed #schedule-zoom-label {
    min-width: 42px !important;
    height: 26px !important;
}

body.header-collapsed #schedule-zoom-out-btn,
body.header-collapsed #schedule-zoom-in-btn,
body.header-collapsed #header-toggle-btn {
    width: 34px !important;
    height: 26px !important;
    padding: 2px 6px !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
}

/* Keep version note visible at the top-left while collapsed */
body.header-collapsed .schedule-version-note {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    position: absolute !important;
    left: 8px !important;
    top: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.62rem !important;
    color: #8fa3b5 !important;
    white-space: nowrap !important;
    z-index: 50 !important;
}

body.header-collapsed .version-logo-img {
    width: 16px !important;
    height: 16px !important;
    object-fit: contain !important;
    opacity: 0.75 !important;
}

/* ARCHIVED VIEW - OBVIOUS READ ONLY MODE */

body.archive-view-mode .page-header {
    border-bottom: 4px solid #facc15 !important;
    box-shadow: inset 0 -4px 0 rgba(250, 204, 21, 0.25);
}

body.archive-view-mode .schedule-version-note::after {
    content: "  |  ARCHIVED READ-ONLY VIEW";
    color: #facc15;
    font-weight: 900;
    letter-spacing: 0.7px;
}

body.archive-view-mode .header-title-area::after {
    content: "ARCHIVED / READ ONLY";
    display: inline-block;
    margin-top: 8px;
    padding: 5px 12px;
    border: 2px solid #facc15;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.14);
    color: #facc15;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 1px;
}

body.archive-view-mode .schedule-toolbox {
    border-color: #facc15 !important;
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.2), 0 8px 20px rgba(0, 0, 0, 0.45) !important;
}

body.archive-view-mode #return-current-schedule-btn {
    background: #facc15 !important;
    color: #111111 !important;
    border-color: #facc15 !important;
    font-weight: 900 !important;
}

body.archive-view-mode .schedule-wrapper {
    background: repeating-linear-gradient( 45deg, rgba(250, 204, 21, 0.035), rgba(250, 204, 21, 0.035) 10px, transparent 10px, transparent 20px ), #101820;
}

body.archive-view-mode .editable-cell {
    cursor: not-allowed !important;
}

/* PERSONNEL EFFECTIVE DATE NOTES */

.personnel-effective-date-note {
    margin: 3px 0 8px;
    color: #9ca3af;
    font-size: 0.72rem;
    line-height: 1.25;
}

body.light-mode .personnel-effective-date-note {
    color: #64748b;
}

/* ARCHIVED PRINT MODE */

@media print {
    body.archive-view-mode .page-header {
        border-bottom: 4px solid #facc15 !important;
    }

    body.archive-view-mode .header-title-area::after {
        content: "ARCHIVED / READ ONLY";
        display: block;
        margin-top: 6px;
        padding: 4px 10px;
        border: 2px solid #000000;
        color: #000000;
        font-size: 0.8rem;
        font-weight: 900;
        letter-spacing: 1px;
    }

    body.archive-view-mode .schedule-version-note::after {
        content: " | ARCHIVED READ-ONLY PRINT";
        color: #000000;
        font-weight: 900;
    }

    body.archive-view-mode .schedule-toolbox,
    body.archive-view-mode .top-scrollbar,
    body.archive-view-mode #vacation-calendar-view,
    body.archive-view-mode .schedule-view-toggle-bar {
        display: none !important;
    }

    body.archive-view-mode .schedule-wrapper {
        background: #ffffff !important;
    }

    body.archive-view-mode .quarter-board {
        border: 1px solid #000000 !important;
    }
}

/* ARCHIVE VIEW ACTION BUTTONS */

.archive-view-actions {
    display: none !important;
}

body.archive-view-mode .archive-view-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

body.archive-view-mode #print-archived-schedule-btn {
    background: #facc15 !important;
    color: #111111 !important;
    border-color: #facc15 !important;
    font-weight: 900 !important;
}

/* SAVE AND EXIT BUTTON - EDIT MODE */

.make-changes-btn.unlocked {
    background: #15803d !important;
    border-color: #22c55e !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2), 0 4px 10px rgba(0, 0, 0, 0.35) !important;
}

    .make-changes-btn.unlocked:hover {
        background: #166534 !important;
        border-color: #4ade80 !important;
    }

/* BULK ASSIGN NAMES MODAL */

.assign-names-form-box {
    width: min(760px, 94vw);
    max-height: 86vh;
    overflow-y: auto;
}

.assign-names-note {
    margin: 0 0 12px;
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.35;
}

.assign-names-list {
    display: grid;
    gap: 8px;
}

.assign-names-group-title {
    margin: 12px 0 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid #394856;
    color: #ffffff;
    font-size: 0.9rem;
}

.assign-names-row {
    display: grid;
    grid-template-columns: minmax(125px, 170px) 1fr;
    gap: 10px;
    align-items: center;
}

    .assign-names-row label {
        margin: 0;
        color: #cbd5e1;
        font-size: 0.78rem;
    }

    .assign-names-row input {
        width: 100%;
        padding: 7px 8px;
        background: #0b1117;
        border: 1px solid #394856;
        border-radius: 5px;
        color: #ffffff;
    }

body.light-mode .assign-names-note,
body.light-mode .assign-names-row label {
    color: #475569;
}

body.light-mode .assign-names-group-title {
    color: #111827;
}

/* PRIMARY VIEW-SWITCH BUTTONS */

/* Main toolbox button: open Vacation Calendar */
#toggle-vacation-view-btn {
    background: #d29922 !important;
    color: #111111 !important;
    border: 2px solid #f0b429 !important;
    font-weight: 900 !important;
    letter-spacing: 0.3px;
    box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.25);
}

    #toggle-vacation-view-btn:hover {
        background: #f0b429 !important;
        border-color: #ffd166 !important;
    }

/* Vacation-calendar header button: return to Shift Schedule */
.schedule-view-toggle-btn {
    background: #2563eb !important;
    color: #ffffff !important;
    border: 2px solid #60a5fa !important;
    font-weight: 900 !important;
    letter-spacing: 0.3px;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25);
}

    .schedule-view-toggle-btn:hover {
        background: #1d4ed8 !important;
        border-color: #93c5fd !important;
    }

/* ASSIGN NAMES: MAKE EXTRA / OPTIONAL ROWS OBVIOUS */

.assign-names-row {
    display: grid;
    grid-template-columns: minmax(145px, 1fr) minmax(180px, 1.5fr);
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 6px;
}

    .assign-names-row label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin: 0;
        font-weight: bold;
    }

.assign-names-current-row {
    background: #17212b;
    border: 1px solid #394856;
}

.assign-names-extra-row {
    margin-top: 10px;
    background: rgba(210, 153, 34, 0.14);
    border: 2px dashed #d29922;
}

    .assign-names-extra-row input {
        background: #2a2415 !important;
        border-color: #d29922 !important;
    }

.assign-names-extra-badge {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 4px;
    background: #d29922;
    color: #111111;
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

/* ==========================================================
   ORGANIZED EXPANDED TOOLBOX LAYOUT
   Uses named functional groups instead of brittle row numbers.
   ========================================================== */

.toolbox-section-label {
    color: #8fa3b5;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-transform: uppercase;
}

.toolbox-right-label {
    margin-top: 10px;
    padding-top: 7px;
    border-top: 1px solid rgba(107, 124, 143, 0.35);
}

.schedule-toolbox > .toolbox-right-label {
    width: 250px;
    margin-left: auto;
}

.toolbox-group {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 9px;
    border: 1px solid rgba(107, 124, 143, 0.46);
    border-radius: 8px;
    background: rgba(11, 17, 23, 0.52);
}

.toolbox-group .toolbox-row {
    margin: 0 !important;
}

.toolbox-group-history {
    grid-area: history;
    grid-template-columns: minmax(0, 1fr) minmax(185px, 0.8fr);
    align-items: end;
}

.toolbox-group-history > .toolbox-section-label {
    grid-column: 1 / -1;
}

.toolbox-group-history .toolbox-mini-status {
    margin: 0;
    min-height: 31px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbox-group-clipboard {
    grid-area: clipboard;
}

.toolbox-group-setup {
    grid-area: setup;
}

.toolbox-group-personnel {
    grid-area: personnel;
}

.toolbox-group-data {
    grid-area: data;
}

.toolbox-group-archive {
    grid-area: archive;
}

body:not(.schedule-locked) .page-header {
    min-height: 410px;
}

body:not(.schedule-locked) .schedule-toolbox {
    width: min(1080px, calc(100vw - 340px)) !important;
    min-height: 390px;
    overflow: hidden;
}

body:not(.schedule-locked) .schedule-toolbox > .toolbox-title,
body:not(.schedule-locked) .schedule-toolbox > .toolbox-right-label,
body:not(.schedule-locked) .schedule-toolbox > .toolbox-row:not(.toolbox-edit-tools .toolbox-row) {
    width: 255px;
    margin-left: auto;
}

body:not(.schedule-locked) .toolbox-edit-tools {
    display: grid !important;
    position: absolute !important;
    left: 10px;
    top: 14px;
    width: calc(100% - 295px);
    padding: 0 12px 0 0;
    margin: 0;
    border-top: none;
    border-right: 1px solid #394856;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    grid-template-areas:
        "history history"
        "clipboard clipboard"
        "setup personnel"
        "setup archive"
        "data data";
    gap: 9px;
    opacity: 1;
    transform: none;
}

body:not(.schedule-locked) .toolbox-edit-tools .toolbox-btn {
    padding: 7px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
}

body.light-mode .toolbox-group {
    border-color: rgba(100, 116, 139, 0.5);
    background: rgba(241, 245, 249, 0.86);
}

body.light-mode .toolbox-section-label {
    color: #64748b;
}

/* Medium / narrow screens: stack the edit groups safely. */
@media (max-width: 1100px) {
    body:not(.schedule-locked) .page-header {
        min-height: 0;
    }

    body:not(.schedule-locked) .schedule-toolbox {
        width: min(760px, 96vw) !important;
        min-height: 0;
        overflow: visible;
    }

    body:not(.schedule-locked) .schedule-toolbox > .toolbox-title,
    body:not(.schedule-locked) .schedule-toolbox > .toolbox-right-label,
    body:not(.schedule-locked) .schedule-toolbox > .toolbox-row:not(.toolbox-edit-tools .toolbox-row) {
        width: 100%;
        margin-left: 0;
    }

    body:not(.schedule-locked) .toolbox-edit-tools {
        position: static !important;
        width: 100%;
        padding: 9px 0 0;
        margin-top: 9px;
        border-top: 1px solid #394856;
        border-right: none;
        grid-template-columns: 1fr;
        grid-template-areas:
            "history"
            "clipboard"
            "setup"
            "personnel"
            "data"
            "archive";
    }
}

@media (max-width: 560px) {
    .toolbox-group-history {
        grid-template-columns: 1fr;
    }

    .toolbox-group-history .toolbox-mini-status {
        min-height: 0;
    }

    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-btn {
        font-size: 0.68rem;
        padding: 6px;
    }
}


/* ==========================================================
   AUTH PORTAL + RESPONSIVE LOGIN STYLES
   Moved from index.html during CSS cleanup.
   ========================================================== */

    body.auth-loading,
    body.auth-locked {
      margin: 0;
      min-height: 100vh;
      background: #eef4fb;
    }

    body.auth-loading > :not(#auth-gate),
    body.auth-locked > :not(#auth-gate) {
      display: none !important;
    }

    body.auth-ready #auth-gate {
      display: none !important;
    }

    .auth-gate,
    .auth-gate * {
      box-sizing: border-box;
    }

    .auth-gate {
      position: fixed;
      inset: 0;
      z-index: 999999;
      display: grid;
      grid-template-rows: auto 1fr;
      overflow: auto;
      min-height: 100vh;
      color: #10284a;
      font-family: Arial, Helvetica, sans-serif;
      background:
        radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.96), rgba(242, 247, 252, 0.95) 52%, rgba(229, 238, 248, 0.98) 100%);
    }

    .auth-civic-header {
      position: relative;
      z-index: 5;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items: center;
      gap: 24px;
      min-height: 112px;
      padding: 8px 28px 9px;
      border-bottom: 4px solid rgba(210, 220, 232, 0.94);
      background:
        linear-gradient(180deg, rgba(4, 32, 68, 0.99), rgba(2, 23, 52, 1));
      box-shadow: 0 7px 24px rgba(4, 25, 53, 0.22);
    }

    .auth-civic-header::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 1px;
      background: rgba(255, 255, 255, 0.22);
    }

    .auth-civic-logo {
      width: 92px;
      max-height: 100px;
      object-fit: contain;
      filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.32));
    }

    .auth-civic-title {
      min-width: 0;
      color: #ffffff;
      font-family: 'Black Ops One', Impact, Arial Black, sans-serif;
      font-size: clamp(2.35rem, 4vw, 4.5rem);
      font-weight: 400;
      letter-spacing: 0.035em;
      line-height: 1.02;
      text-transform: uppercase;
      text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
    }

    .auth-civic-motto-wrap {
      display: flex;
      align-items: center;
      align-self: stretch;
      padding-left: 30px;
      border-left: 2px solid rgba(228, 237, 248, 0.65);
    }

    .auth-civic-motto {
      max-width: 470px;
      color: rgba(245, 249, 255, 0.94);
      font-family: 'Black Ops One', Impact, Arial Black, sans-serif;
      font-size: clamp(0.78rem, 1.18vw, 1.16rem);
      font-weight: 400;
      letter-spacing: 0.15em;
      line-height: 1.6;
      text-align: right;
      text-transform: uppercase;
    }

    .auth-civic-body {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 0;
      padding: 12px 20px 16px;
      overflow: hidden;
      align-items: flex-start;
    }

    .auth-civic-watermark {
      position: absolute;
      right: -5vw;
      top: 50%;
      width: clamp(430px, 46vw, 770px);
      max-height: 84%;
      object-fit: contain;
      opacity: 0.065;
      pointer-events: none;
      transform: translateY(-50%);
      filter: grayscale(20%) saturate(0.7);
    }

    .auth-gate-box {
      position: relative;
      z-index: 3;
      width: min(94vw, 760px);
      margin-top: 2px;
      padding: 13px 42px 16px;
      border: 1px solid rgba(201, 212, 226, 0.95);
      border-radius: 13px;
      background: rgba(255, 255, 255, 0.98);
      box-shadow:
        0 20px 48px rgba(27, 55, 88, 0.16),
        0 4px 12px rgba(27, 55, 88, 0.08);
    }

    .auth-lock-heading {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 14px;
      margin-bottom: 3px;
    }

    .auth-lock-heading::before,
    .auth-lock-heading::after {
      content: "";
      flex: 1;
      height: 1px;
      background: #cfd9e5;
    }

    .auth-lock-shield {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 78px;
      height: 86px;
      filter: drop-shadow(0 4px 5px rgba(11, 40, 76, 0.18));
    }

    .auth-lock-shield img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
    }

    .auth-lock-overlay {
      position: absolute;
      right: 1px;
      bottom: 2px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 19px;
      height: 19px;
      border: 1px solid #ffffff;
      border-radius: 50%;
      background: linear-gradient(180deg, #184a86, #072d60);
      color: #ffffff;
      font-size: 0.66rem;
      line-height: 1;
      box-shadow: 0 2px 6px rgba(11, 40, 76, 0.25);
    }

    .auth-stars {
      margin: -5px 0 2px;
      color: #16477f;
      text-align: center;
      font-size: 0.94rem;
      letter-spacing: 0.45em;
    }

    .auth-gate h1 {
      margin: 0;
      color: #082b5c;
      font-family: 'Black Ops One', Impact, Arial Black, sans-serif;
      font-size: clamp(1.55rem, 2.55vw, 2.15rem);
      font-weight: 400;
      letter-spacing: 0.025em;
      text-transform: uppercase;
      line-height: 1.02;
      text-align: center;
      white-space: nowrap;
    }

    .auth-gate-subtitle {
      margin: 5px 0 9px;
      color: #5d6f83;
      font-size: 1rem;
      line-height: 1.35;
      text-align: center;
    }

    .auth-card-rule {
      height: 1px;
      margin: 0 0 8px;
      background: #d8e0e9;
    }

    .auth-gate label {
      display: block;
      margin: 6px 0 4px;
      color: #082b5c;
      font-size: 0.92rem;
      font-weight: 700;
    }

    .auth-input-wrap {
      position: relative;
    }

    .auth-input-icon {
      position: absolute;
      top: 50%;
      left: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      color: #60758d;
      font-size: 1rem;
      transform: translateY(-50%);
      pointer-events: none;
    }

    .auth-gate input {
      width: 100%;
      height: 42px;
      padding: 12px 14px 12px 47px;
      border: 1px solid #b8c5d4;
      border-radius: 5px;
      outline: none;
      background: #ffffff;
      color: #17375d;
      font-size: 1rem;
      transition: border-color 150ms ease, box-shadow 150ms ease;
    }

    .auth-gate input:focus {
      border-color: #0b4d96;
      box-shadow: 0 0 0 3px rgba(11, 77, 150, 0.14);
    }

    .auth-gate button {
      width: 100%;
      margin-top: 9px;
      padding: 10px 18px;
      border: 1px solid #02254e;
      border-radius: 5px;
      background: linear-gradient(180deg, #073a77, #032957);
      color: #ffffff;
      font-size: 1rem;
      font-weight: 800;
      cursor: pointer;
      transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
    }

    .auth-gate button:hover:not(:disabled) {
      transform: translateY(-1px);
      background: linear-gradient(180deg, #0a4b96, #04356f);
      box-shadow: 0 7px 14px rgba(5, 46, 94, 0.18);
    }

    .auth-gate button:disabled {
      opacity: 0.64;
      cursor: wait;
    }

    .auth-gate-error {
      min-height: 14px;
      margin: 6px 0 0;
      color: #b42318;
      font-size: 0.86rem;
      line-height: 1.35;
    }

    .schedule-logout-btn {
      width: 100%;
      border-color: rgba(108, 201, 255, 0.72);
      background: linear-gradient(180deg, rgba(12, 58, 96, 0.96), rgba(5, 30, 54, 0.98));
      color: #eef9ff;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      box-shadow: 0 0 12px rgba(46, 157, 226, 0.14);
      transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
    }

    .schedule-logout-btn:hover:not(:disabled) {
      transform: translateY(-1px);
      border-color: #9edcff;
      box-shadow: 0 0 16px rgba(46, 157, 226, 0.28);
    }

    .schedule-logout-btn:disabled {
      opacity: 0.65;
      cursor: wait;
    }

    .toolbox-btn:disabled {
      opacity: 0.48;
      cursor: not-allowed;
    }

    .toolbox-mini-status {
      margin-top: 7px;
      padding: 6px 7px;
      border: 1px solid rgba(107, 124, 143, 0.5);
      border-radius: 5px;
      background: rgba(11, 17, 23, 0.58);
      color: #b9c8d6;
      font-size: 0.66rem;
      line-height: 1.3;
      text-align: center;
    }

    @media (min-width: 1200px) {
      .auth-civic-header {
        grid-template-columns: auto minmax(0, 1fr) max-content;
        gap: 18px;
        padding-left: 28px;
        padding-right: 28px;
      }

      .auth-civic-title {
        font-size: clamp(2.15rem, 2.75vw, 3.25rem);
        letter-spacing: 0.025em;
        white-space: nowrap;
      }

      .auth-civic-motto-wrap {
        padding-left: 22px;
      }

      .auth-civic-motto {
        max-width: none;
        font-size: clamp(0.66rem, 0.78vw, 0.9rem);
        letter-spacing: 0.11em;
        line-height: 1.2;
        white-space: nowrap;
      }
    }

    @media (max-height: 820px) and (min-width: 651px) {
      .auth-civic-header {
        min-height: 98px;
        padding-top: 6px;
        padding-bottom: 7px;
      }

      .auth-civic-logo {
        width: 80px;
        max-height: 88px;
      }

      .auth-civic-body {
        padding-top: 9px;
        padding-bottom: 12px;
      }

      .auth-gate-box {
        padding-top: 11px;
        padding-bottom: 13px;
      }
    }

    @media (max-height: 650px) and (min-width: 651px) {
      .auth-civic-header {
        min-height: 92px;
      }

      .auth-civic-logo {
        width: 74px;
        max-height: 80px;
      }

      .auth-civic-body {
        padding-top: 7px;
        padding-bottom: 9px;
      }

      .auth-gate-box {
        padding-top: 9px;
        padding-bottom: 11px;
      }

      .auth-lock-shield {
        width: 68px;
        height: 74px;
      }

      .auth-stars {
        margin-bottom: 1px;
      }

      .auth-gate-subtitle {
        margin-top: 3px;
        margin-bottom: 6px;
      }

      .auth-card-rule {
        margin-bottom: 6px;
      }

      .auth-gate label {
        margin-top: 4px;
      }
    }

    @media (orientation: landscape) and (max-height: 560px) {
      .auth-gate {
        display: block;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
      }

      .auth-civic-header {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px;
        min-height: 72px;
        padding: 5px 12px 6px;
      }

      .auth-civic-logo {
        width: 56px;
        max-height: 62px;
      }

      .auth-civic-title {
        font-size: clamp(1.3rem, 3.8vw, 2rem);
        line-height: 0.98;
      }

      .auth-civic-motto-wrap {
        grid-column: auto;
        align-self: stretch;
        padding: 0 0 0 12px;
        border-top: 0;
        border-left: 1px solid rgba(228, 237, 248, 0.58);
      }

      .auth-civic-motto {
        max-width: 240px;
        font-size: 0.48rem;
        letter-spacing: 0.1em;
        line-height: 1.25;
        text-align: right;
      }

      .auth-civic-body {
        min-height: auto;
        padding: 8px 10px 14px;
        overflow: visible;
      }

      .auth-gate-box {
        width: min(94vw, 760px);
        margin: 0 auto;
        padding: 8px 30px 10px;
      }

      .auth-lock-heading {
        margin-bottom: 1px;
      }

      .auth-lock-shield {
        width: 54px;
        height: 60px;
      }

      .auth-lock-overlay {
        width: 16px;
        height: 16px;
        font-size: 0.54rem;
      }

      .auth-stars {
        margin: -5px 0 0;
      }

      .auth-gate h1 {
        font-size: clamp(1.35rem, 3.2vw, 1.8rem);
        white-space: nowrap;
      }

      .auth-gate-subtitle {
        margin: 3px 0 5px;
        font-size: 0.78rem;
      }

      .auth-card-rule {
        margin-bottom: 5px;
      }

      .auth-gate label {
        margin: 4px 0 3px;
        font-size: 0.78rem;
      }

      .auth-gate input {
        height: 36px;
        padding-top: 8px;
        padding-bottom: 8px;
        font-size: 0.86rem;
      }

      .auth-gate-error {
        min-height: 10px;
        margin-top: 3px;
        font-size: 0.75rem;
      }

      .auth-gate button {
        position: sticky;
        bottom: max(6px, env(safe-area-inset-bottom));
        z-index: 5;
        margin-top: 5px;
        padding: 9px 14px;
        font-size: 0.88rem;
        box-shadow: 0 4px 12px rgba(5, 46, 94, 0.24);
      }

      .auth-gate-box {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
      }

      .auth-civic-body {
        padding-bottom: calc(26px + env(safe-area-inset-bottom));
      }
    }

    @media (max-width: 1040px) {
      .auth-civic-header {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 18px;
        min-height: 126px;
        padding: 10px 22px;
      }

      .auth-civic-logo {
        width: 96px;
        max-height: 112px;
      }

      .auth-civic-title {
        font-size: clamp(2rem, 5vw, 3.3rem);
      }

      .auth-civic-motto-wrap {
        grid-column: 1 / -1;
        justify-content: center;
        align-self: auto;
        padding: 7px 0 0;
        border-top: 1px solid rgba(228, 237, 248, 0.34);
        border-left: 0;
      }

      .auth-civic-motto {
        max-width: none;
        text-align: center;
        font-size: 0.78rem;
      }
    }

    @media (max-width: 650px) {
      .auth-civic-header {
        gap: 12px;
        min-height: 118px;
        padding: 11px 15px 10px;
      }

      .auth-civic-logo {
        width: 72px;
        max-height: 82px;
      }

      .auth-civic-title {
        font-size: clamp(1.5rem, 6.4vw, 2.2rem);
        line-height: 1;
      }

      .auth-civic-motto {
        font-size: 0.58rem;
        letter-spacing: 0.1em;
      }

      .auth-civic-body {
        padding: 18px 14px 24px;
      }

      .auth-civic-watermark {
        right: -28vw;
        width: min(118vw, 580px);
        opacity: 0.055;
      }

      .auth-gate-box {
        width: min(95vw, 520px);
        padding: 19px 20px 22px;
      }

      .auth-lock-shield {
        width: 68px;
        height: 74px;
      }

      .auth-lock-overlay {
        width: 17px;
        height: 17px;
        font-size: 0.58rem;
      }

      .auth-gate h1 {
        font-size: clamp(1.45rem, 6.2vw, 1.95rem);
        white-space: normal;
      }

      .auth-gate-subtitle {
        font-size: 0.9rem;
      }
    }

/* ==========================================================
   FIREBASE BACKUP HISTORY + SAFE RESTORE MODAL
   ========================================================== */

.backup-history-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.72);
}

.backup-history-modal.hidden {
    display: none;
}

.backup-history-box {
    width: min(860px, 96vw);
    max-height: min(760px, 92vh);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid #435466;
    border-radius: 12px;
    background: #111922;
    color: #f8fafc;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
}

.backup-history-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.backup-history-heading-row h3 {
    margin: 0;
    font-size: 1.25rem;
}

.backup-history-heading-row p {
    margin: 6px 0 0;
    color: #b7c5d3;
    font-size: 0.86rem;
    line-height: 1.45;
}

.backup-history-close-btn {
    min-width: 34px;
    min-height: 34px;
    border: 1px solid #52677a;
    border-radius: 7px;
    background: #1b2733;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
}

.backup-history-status {
    padding: 9px 10px;
    border: 1px solid rgba(107, 124, 143, 0.5);
    border-radius: 7px;
    background: rgba(11, 17, 23, 0.72);
    color: #c7d4e0;
    font-size: 0.82rem;
    line-height: 1.35;
}

.backup-history-list {
    min-height: 180px;
    overflow-y: auto;
    display: grid;
    gap: 8px;
    padding-right: 4px;
}

.backup-history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 11px;
    border: 1px solid #334455;
    border-radius: 8px;
    background: rgba(24, 35, 46, 0.96);
}

.backup-history-card-summary {
    min-width: 0;
}

.backup-history-card-title {
    color: #f8fafc;
    font-weight: 900;
    letter-spacing: 0.035em;
}

.backup-history-card-meta,
.backup-history-card-reason {
    margin-top: 4px;
    color: #b7c5d3;
    font-size: 0.78rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.backup-history-card-reason {
    color: #94a8bb;
}

.backup-history-restore-btn,
.backup-history-actions button {
    border: 1px solid #52759b;
    border-radius: 7px;
    padding: 8px 12px;
    background: #173b61;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.backup-history-restore-btn:hover,
.backup-history-actions button:hover {
    background: #215486;
}

.backup-history-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.backup-history-empty {
    padding: 20px;
    border: 1px dashed #52677a;
    border-radius: 8px;
    color: #b7c5d3;
    text-align: center;
}

.backup-history-busy .backup-history-restore-btn,
.backup-history-busy .backup-history-actions button {
    opacity: 0.55;
    pointer-events: none;
}

body.light-mode .backup-history-box {
    border-color: #c4cfdb;
    background: #f8fafc;
    color: #14283d;
}

body.light-mode .backup-history-heading-row p,
body.light-mode .backup-history-card-meta,
body.light-mode .backup-history-card-reason,
body.light-mode .backup-history-status,
body.light-mode .backup-history-empty {
    color: #50657a;
}

body.light-mode .backup-history-card {
    border-color: #cbd5df;
    background: #ffffff;
}

body.light-mode .backup-history-card-title {
    color: #14283d;
}

@media (max-width: 620px) {
    .backup-history-modal {
        align-items: flex-start;
        padding: 9px;
    }

    .backup-history-box {
        max-height: 96vh;
        padding: 12px;
    }

    .backup-history-card {
        align-items: stretch;
        flex-direction: column;
    }

    .backup-history-restore-btn {
        width: 100%;
    }
}

/* ==========================================================
   SHIFT GRID COPY / PASTE
   ========================================================== */

.toolbox-row.three-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.clipboard-selected-cell {
    position: relative;
    outline: 2px solid #4ea1ff !important;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 999px rgba(45, 125, 205, 0.16);
}

.clipboard-selection-anchor {
    outline-color: #ffffff !important;
    box-shadow:
        inset 0 0 0 999px rgba(45, 125, 205, 0.2),
        inset 0 0 0 3px #4ea1ff;
}

body.light-mode .clipboard-selected-cell {
    outline-color: #0b65c2 !important;
    box-shadow: inset 0 0 0 999px rgba(37, 99, 235, 0.13);
}

body.light-mode .clipboard-selection-anchor {
    outline-color: #0f172a !important;
    box-shadow:
        inset 0 0 0 999px rgba(37, 99, 235, 0.15),
        inset 0 0 0 3px #0b65c2;
}

/* ==========================================================
   EXPANDED TOOLBOX HEIGHT / SHORT-DESKTOP FIX
   Prevent the lower edit groups from being clipped after the
   Grid Copy / Paste section was added.
   ========================================================== */

body:not(.schedule-locked) .page-header {
    min-height: 455px;
    overflow: visible;
    align-items: start;
}

body:not(.schedule-locked) .schedule-toolbox {
    min-height: 435px;
    overflow: visible;
    align-self: start !important;
}

/*
   On shorter desktop displays, tighten the spacing slightly.
   The toolbox remains fully accessible without changing the
   button organization or hiding Data & Output.
*/
@media (min-width: 1101px) and (max-height: 760px) {
    body:not(.schedule-locked) .page-header {
        min-height: 440px;
        padding-top: 4px;
    }

    body:not(.schedule-locked) .schedule-toolbox {
        min-height: 425px;
    }

    body:not(.schedule-locked) .toolbox-edit-tools {
        top: 9px;
        gap: 6px;
    }

    body:not(.schedule-locked) .toolbox-group {
        gap: 4px;
        padding: 7px;
    }

    body:not(.schedule-locked) .toolbox-edit-tools .toolbox-btn {
        padding: 6px 8px;
    }

    body:not(.schedule-locked) .toolbox-group-history .toolbox-mini-status,
    body:not(.schedule-locked) .toolbox-group-clipboard .toolbox-mini-status {
        min-height: 27px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
}

/*
   Very short desktop browser windows still get access to every
   control through a small internal toolbox scrollbar.
*/
@media (min-width: 1101px) and (max-height: 560px) {
    body:not(.schedule-locked) .schedule-toolbox {
        max-height: calc(100vh - 12px);
        overflow-y: auto;
        overflow-x: hidden;
    }
}

/* ==========================================================
   COLLAPSED HEADER PRESENCE + SINGLE-EDITOR INDICATOR
   ========================================================== */

.schedule-version-note-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-presence-strip {
    display: none;
}

body.header-collapsed .schedule-version-note {
    max-width: calc(100vw - 430px) !important;
}

body.header-collapsed .schedule-version-note-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.header-collapsed .schedule-presence-strip {
    position: absolute;
    top: 3px;
    right: 168px;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
}

.schedule-presence-circle {
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    border: 2px solid #4ea1ff;
    border-radius: 50%;
    background: #14375d;
    color: #ffffff;
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.035em;
    line-height: 1;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.38);
    cursor: default;
}

.schedule-presence-circle.is-editing {
    border-color: #22c55e;
    background: #14532d;
}

.schedule-presence-overflow {
    border-color: #8fa3b5;
    background: #263645;
    color: #e5edf5;
}

body.light-mode .schedule-presence-circle {
    border-color: #0b65c2;
    background: #dbeafe;
    color: #102a43;
}

body.light-mode .schedule-presence-circle.is-editing {
    border-color: #15803d;
    background: #dcfce7;
    color: #14532d;
}

@media (max-width: 760px) {
    body.header-collapsed .schedule-version-note {
        max-width: calc(100vw - 285px) !important;
    }

    body.header-collapsed .schedule-presence-strip {
        right: 145px;
        gap: 2px;
    }

    .schedule-presence-circle {
        width: 22px;
        height: 22px;
        font-size: 0.52rem;
    }
}



/* ==========================================================
   SCHEDULE VIEWER / COMMAND-EDITOR PERMISSIONS
   ========================================================== */

body.schedule-viewer-only #make-changes-btn {
    color: #9aa8b6;
    background: #111922;
    border-color: #394856;
    cursor: not-allowed;
    opacity: 0.78;
}

body.schedule-viewer-only #make-changes-btn:hover {
    color: #9aa8b6;
    background: #111922;
}

body.schedule-viewer-only .toolbox-edit-tools {
    display: none !important;
}

body.schedule-viewer-only .row-hide-btn {
    display: none !important;
}

.schedule-admin-only-control:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

body.schedule-command-editor #make-changes-btn {
    opacity: 1;
}



body.schedule-auto-fit-active #schedule-fit-screen-btn {
    color: #111111;
    background: #f0cd7a;
    border-color: #fff2b2;
}

body.schedule-big-screen-fit .schedule-wrapper {
    padding-top: 4px;
    padding-bottom: 4px;
}

body.schedule-big-screen-fit .schedule-table th,
body.schedule-big-screen-fit .schedule-table td {
    line-height: 1.05;
}

body.schedule-big-screen-fit .officer-col,
body.schedule-big-screen-fit .admin-section-label {
    min-width: 150px;
}

/* Keep the collapsed header compact: Fit is available only when the header/toolbox is expanded. */



/* Big-screen fit is a viewer/display feature only. While editing, keep the toolbox anchored normally. */
body:not(.schedule-locked).schedule-big-screen-fit {
    --schedule-view-zoom: 1;
}

body:not(.schedule-locked) #schedule-fit-screen-btn {
    opacity: 0.55;
}



.schedule-zoom-row .toolbox-btn,
.schedule-zoom-row .zoom-btn {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    padding: 5px 4px !important;
    overflow: hidden;
    text-align: center;
    white-space: nowrap;
}

.schedule-zoom-row .schedule-zoom-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.fit-screen-btn {
    font-size: 0.64rem !important;
    line-height: 1 !important;
    padding: 5px 1px !important;
    letter-spacing: 0 !important;
}





@media (max-width: 700px) {
    .schedule-zoom-row {
        grid-template-columns: 26px minmax(30px, 1fr) 28px 28px 26px 26px;
        gap: 2px;
    }

    .schedule-zoom-row .toolbox-btn,
    .schedule-zoom-row .zoom-btn {
        min-width: 0 !important;
        width: 100% !important;
        padding: 5px 1px !important;
        font-size: 0.68rem !important;
    }

    .fit-screen-btn {
        font-size: 0.56rem !important;
        letter-spacing: 0 !important;
    }

    .schedule-zoom-label {
        min-width: 0 !important;
        overflow: hidden;
        white-space: nowrap;
        font-size: 0.66rem !important;
    }
}



/* ==========================================================
   MOBILE FULL SCREEN SCHEDULE VIEWER
   ========================================================== */

.mobile-viewer-open-btn {
    white-space: nowrap;
}

.mobile-schedule-viewer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #050814;
    color: #e8edf7;
}

.mobile-schedule-viewer.hidden {
    display: none !important;
}

body.mobile-viewer-open {
    overflow: hidden !important;
    touch-action: none;
}

.mobile-viewer-shell {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top, rgba(46, 91, 160, 0.28), transparent 34%),
        #050814;
}

.mobile-viewer-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(8, 13, 28, 0.96);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.mobile-viewer-toolbar h3 {
    margin: 0;
    font-size: 0.98rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-viewer-toolbar p {
    margin: 2px 0 0;
    font-size: 0.68rem;
    color: rgba(232, 237, 247, 0.72);
}

.mobile-viewer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: nowrap;
}

.mobile-viewer-actions button {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.09);
    color: #f8fbff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 7px 8px;
}

#mobile-viewer-close-btn {
    min-width: 34px;
    font-size: 1.15rem;
    line-height: 1;
    padding: 6px 8px;
}

.mobile-viewer-stage {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
        #070b16;
    background-size: 26px 26px;
}

.mobile-viewer-content {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.mobile-viewer-content .quarter-board {
    margin: 0 !important;
    transform: none !important;
    zoom: 1 !important;
}

.mobile-viewer-content .schedule-table {
    zoom: 1 !important;
}

.mobile-viewer-content [contenteditable="true"] {
    cursor: default !important;
}

.mobile-viewer-content .officer-name,
.mobile-viewer-content .officer-col,
.mobile-viewer-content .admin-section-label,
.mobile-viewer-content .support-section-label {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
}

.mobile-viewer-footer {
    flex: 0 0 auto;
    padding: 5px 10px max(6px, env(safe-area-inset-bottom));
    text-align: center;
    font-size: 0.66rem;
    color: rgba(232, 237, 247, 0.62);
    background: rgba(8, 13, 28, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 901px) {
    .mobile-viewer-open-btn::after {
        content: " View";
    }
}

@media (max-width: 520px) {
    .mobile-viewer-toolbar {
        align-items: flex-start;
        padding-left: 8px;
        padding-right: 8px;
    }

    .mobile-viewer-toolbar h3 {
        font-size: 0.82rem;
    }

    .mobile-viewer-toolbar p {
        display: none;
    }

    .mobile-viewer-actions {
        gap: 3px;
    }

    .mobile-viewer-actions button {
        font-size: 0.64rem;
        padding: 6px 6px;
        border-radius: 8px;
    }

    #mobile-viewer-close-btn {
        min-width: 30px;
        padding: 5px 7px;
    }
}






/* Viewer button is controlled by the top quick-actions bar in index.html. */
.schedule-top-quick-actions .mobile-viewer-quick-btn {
    position: static !important;
    top: auto !important;
    right: auto !important;
}



/* Viewer toggle button behavior */
body.mobile-viewer-open .schedule-top-quick-actions {
    z-index: 2147483647;
}

.mobile-viewer-quick-btn.viewer-toggle-active,
body.mobile-viewer-open .mobile-viewer-quick-btn {
    color: #ffffff !important;
    background: linear-gradient(135deg, #7a1d1d, #c0392b) !important;
    border-color: rgba(255, 190, 180, 0.95) !important;
}

body.mobile-viewer-open #mobile-viewer-close-btn {
    display: none !important;
}



/* Viewer fixed names column */
.mobile-viewer-fixed-names {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    overflow: hidden;
    z-index: 4;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5, 8, 20, 0.98), rgba(5, 8, 20, 0.94));
    border-right: 2px solid rgba(240, 205, 122, 0.74);
    box-shadow: 8px 0 18px rgba(0, 0, 0, 0.34);
}

.mobile-viewer-fixed-names-content {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.mobile-viewer-name-item {
    position: absolute;
    left: 0;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-right: 0 !important;
    box-shadow: none !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
}

.mobile-viewer-name-item .row-hide-btn,
.mobile-viewer-name-item button,
.mobile-viewer-name-item input,
.mobile-viewer-name-item select {
    display: none !important;
}

.mobile-viewer-name-item[contenteditable="true"],
.mobile-viewer-name-item *[contenteditable="true"] {
    cursor: default !important;
}

.mobile-viewer-name-item.mobile-viewer-name-blank {
    background: rgba(5, 8, 20, 0.98) !important;
}

.mobile-viewer-name-item.admin-section-label,
.mobile-viewer-name-item.support-section-label {
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.05;
}

.mobile-viewer-stage.has-fixed-names .mobile-viewer-content {
    z-index: 1;
}



/* Embedded viewer week cues.
   These are inserted into the read-only viewer clone only, not the live schedule.
   Because they live inside the transformed viewer content, they scale and pan
   naturally with pinch/drag instead of floating over the grid. */
.mobile-viewer-week-cue-row {
    position: relative;
    box-sizing: border-box;
    height: 34px;
    min-height: 34px;
    margin: 0 !important;
    padding: 0 !important;
    background:
        linear-gradient(90deg, rgba(5, 8, 20, 0.94), rgba(11, 18, 38, 0.88), rgba(5, 8, 20, 0.94));
    border-top: 1px solid rgba(240, 205, 122, 0.35);
    border-bottom: 1px solid rgba(240, 205, 122, 0.35);
    overflow: visible;
    z-index: 6;
}

.mobile-viewer-week-cue-row.mobile-viewer-top-week-cue-row {
    margin-bottom: 3px !important;
}

.mobile-viewer-week-cue-row.mobile-viewer-middle-week-cue-row {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
}

.mobile-viewer-week-cue {
    position: absolute;
    top: 5px;
    box-sizing: border-box;
    height: 24px;
    line-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    color: #101820;
    background: linear-gradient(135deg, rgba(247, 216, 103, 0.98), rgba(217, 155, 18, 0.98));
    border: 1px solid rgba(255, 236, 150, 0.9);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.mobile-viewer-middle-week-cue-row .mobile-viewer-week-cue {
    border-radius: 8px;
}

@media (max-width: 520px) {
    .mobile-viewer-week-cue-row {
        height: 32px;
        min-height: 32px;
    }

    .mobile-viewer-week-cue {
        top: 4px;
        height: 23px;
        line-height: 21px;
        padding: 0 6px;
        font-size: 0.66rem;
        letter-spacing: 0.025em;
    }
}



/* Single embedded week cue.
   Only one label is shown per cue row; JS updates its date range as the
   visible part of the schedule changes. */
.mobile-viewer-week-cue {
    width: 280px;
    max-width: 280px;
}



/* Stable Viewer exit fix.
   Based on the working v14 Viewer baseline. This restores visible exit controls
   on laptop/desktop and avoids changing the pinch/Fit math. */
body.mobile-viewer-open #mobile-viewer-close-btn {
    display: inline-flex !important;
}

body.mobile-viewer-open .mobile-viewer-quick-btn {
    display: inline-flex !important;
}

body.mobile-viewer-open .schedule-top-quick-actions {
    display: inline-flex !important;
    z-index: 2147483647 !important;
}

#mobile-viewer-close-btn {
    cursor: pointer;
}




/* Fit buttons removed.
   The normal schedule Fit and Viewer Fit buttons are intentionally disabled
   because Fit was causing browser STATUS_BREAKPOINT crashes on some devices.
   Use Viewer, Reset, and +/- zoom instead. */
#schedule-fit-screen-btn,
#mobile-viewer-fit-btn,
.fit-screen-btn {
    display: none !important;
}




/* Viewer fixed-name desktop sizing stability. */
.mobile-viewer-fixed-names {
    min-width: 0;
}

@media (min-width: 900px) {
    body.mobile-viewer-open .mobile-viewer-fixed-names {
        min-width: 160px;
    }
}



/* Manual OT sync button */
.sync-ot-sheet-btn {
  background: linear-gradient(135deg, #0f4c81, #102b45);
  border-color: rgba(240, 205, 122, 0.65);
  color: #ffffff;
}

.sync-ot-sheet-btn:hover,
.sync-ot-sheet-btn:focus-visible {
  filter: brightness(1.08);
}

.sync-ot-sheet-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}


/* Editor-only OT sync controls */
body.schedule-locked .toolbox-group-ot-sync,
body.schedule-viewer-only .toolbox-group-ot-sync {
  display: none !important;
}

.toolbox-group-ot-sync {
  border-color: rgba(240, 205, 122, 0.38);
}




/* Editor-only OT sync button in right-side session menu */
.sync-ot-sheet-row {
  display: none;
}

body:not(.schedule-locked).schedule-command-editor .sync-ot-sheet-row {
  display: flex;
}

/* Fullscreen viewer fixed-name polish */
.mobile-viewer-name-item {
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mobile-viewer-name-item .row-hide-btn {
  display: none !important;
}








/* Live-measured Viewer name rail */
.mobile-viewer-fixed-names {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 158px;
    overflow: hidden;
    z-index: 8;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5, 8, 20, 0.99), rgba(5, 8, 20, 0.94));
    border-right: 2px solid rgba(240, 205, 122, 0.78);
    box-shadow: 8px 0 18px rgba(0, 0, 0, 0.38);
}

.mobile-viewer-fixed-names-content {
    position: absolute;
    inset: 0 auto auto 0;
    transform: none !important;
    transform-origin: 0 0;
    will-change: contents;
}

.mobile-viewer-name-item {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0 4px;
    color: #f7fbff;
    background: rgba(8, 13, 28, 0.78);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
}

.mobile-viewer-name-item.shortage-label {
    background: rgba(80, 16, 16, 0.96) !important;
    color: #ffffff !important;
}

.mobile-viewer-name-text {
    display: block;
    width: 100%;
    overflow: hidden;
    color: inherit;
    font-weight: 900;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
    transform: none !important;
}

.mobile-viewer-name-item .row-hide-btn,
.mobile-viewer-name-item button,
.mobile-viewer-name-item input,
.mobile-viewer-name-item select {
    display: none !important;
}

.mobile-viewer-stage.has-fixed-names .mobile-viewer-content {
    z-index: 1;
}


/* Court assignment reminder opt-in button */
body.light-mode 