.horarios-page {
    --h-label: 300px;
    --h-hour: 80px;
    --h-time: 2880px;
    --h-line: #dbe4e8;
    --h-muted: #66737d;
    --h-dark: #0c1720;
    --h-accent: #00a99d;
    --h-shadow: 0 8px 26px rgba(13,30,42,.07)
}

.horarios-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 14px
}

    .horarios-header h1 {
        margin: 0
    }

.horarios-status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800
}

    .horarios-status.draft {
        background: #fff4d8;
        color: #8b5d00
    }

    .horarios-status.published {
        background: #e7f5ec;
        color: #1c6c46
    }

    .horarios-status.unsaved {
        background: #eef2f4;
        color: #5f6d76
    }

.horarios-toolbar {
    background: #fff;
    border: 1px solid var(--h-line);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--h-shadow);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px
}

.horarios-period {
    font-weight: 800;
    min-width: 210px;
    text-align: center
}

.horarios-view-switch {
    display: flex;
    border: 1px solid var(--h-line);
    border-radius: 9px;
    overflow: hidden
}

    .horarios-view-switch button {
        border: 0;
        border-right: 1px solid var(--h-line);
        background: #fff;
        padding: 8px 12px;
        font-weight: 800
    }

        .horarios-view-switch button:last-child {
            border-right: 0
        }

        .horarios-view-switch button.active {
            background: var(--h-dark);
            color: #fff
        }

.horarios-spacer {
    flex: 1
}

.horarios-days {
    display: flex;
    gap: 7px;
    overflow: auto;
    margin: 10px 0 12px
}

.horarios-day {
    min-width: 96px;
    border: 1px solid var(--h-line);
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    font-weight: 800
}

    .horarios-day small {
        display: block;
        color: var(--h-muted);
        margin-top: 2px
    }

    .horarios-day.active {
        background: var(--h-dark);
        color: #fff;
        border-color: var(--h-dark)
    }

        .horarios-day.active small {
            color: #b8c2c8
        }

.horarios-grid {
    display: grid;
    grid-template-columns: 235px minmax(0,1fr);
    gap: 12px;
    align-items: start
}

.horarios-tray, .horarios-timeline-card {
    background: #fff;
    border: 1px solid var(--h-line);
    border-radius: 12px;
    box-shadow: var(--h-shadow)
}

.horarios-tray-head {
    padding: 12px;
    border-bottom: 1px solid var(--h-line);
    font-weight: 800
}

.horarios-tray-body {
    padding: 9px
}

.horarios-search {
    width: 100%;
    border: 1px solid var(--h-line);
    border-radius: 8px;
    padding: 8px 9px;
    margin-bottom: 8px
}

.horarios-emp-card {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--h-line);
    border-radius: 9px;
    padding: 8px;
    margin: 6px 0
}

.horarios-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    border-radius: 50%;
    font-weight: 900;
    flex: none
}

.horarios-emp-main {
    flex: 1;
    min-width: 0
}

    .horarios-emp-main strong {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis
    }

    .horarios-emp-main small {
        display: block;
        color: var(--h-muted);
        line-height: 1.15
    }

.horarios-email {
    display: inline-flex;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    margin-top: 3px
}

    .horarios-email.ok {
        background: #e7f5ec;
        color: #1c6c46
    }

    .horarios-email.pending {
        background: #fff0d7;
        color: #8b5c00
    }

    .horarios-email.none {
        background: #eef2f4;
        color: #68737b
    }

.horarios-timeline-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--h-line);
    background: #fbfcfd
}

.horarios-scroll {
    overflow: auto
}

.horarios-timeline {
    width: calc(var(--h-label) + var(--h-time));
    position: relative
}

.horarios-ruler-row, .horarios-track-row {
    display: grid;
    grid-template-columns: var(--h-label) var(--h-time)
}

.horarios-sticky {
    position: sticky;
    left: 0;
    z-index: 8;
    background: #fff;
    border-right: 1px solid var(--h-line)
}

.horarios-ruler-label {
    height: 43px;
    padding: 12px;
    font-size: 11px;
    font-weight: 800;
    color: var(--h-muted);
    background: #f8fafb
}

.horarios-ruler {
    height: 43px;
    position: relative;
    background: repeating-linear-gradient(to right,#f8fafb 0,calc(var(--h-hour) - 1px),#e6ecef calc(var(--h-hour) - 1px),#e6ecef var(--h-hour))
}

.horarios-tick {
    position: absolute;
    top: 8px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #69767e;
    font-weight: 800;
    white-space: nowrap
}

.horarios-track-label {
    min-height: 94px;
    padding: 9px;
    display: flex;
    align-items: center;
    gap: 8px
}

    .horarios-track-label .horarios-avatar {
        width: 40px;
        height: 40px
    }

.horarios-track-meta {
    flex: 1;
    min-width: 0
}

.horarios-track-name {
    font-weight: 900
}

.horarios-track-stats {
    font-size: 11px;
    color: var(--h-muted);
    line-height: 1.25;
    margin-top: 2px
}

.horarios-track-actions {
    margin-left: auto;
    display: flex;
    gap: 5px
}

.horarios-track-area {
    height: 95px;
    position: relative;
    background: repeating-linear-gradient(to right,#fbfcfd 0,19px,#edf1f3 19px,#edf1f3 20px);
    border-top: 1px solid #edf1f3
}

    .horarios-track-area.empty:after {
        content: 'Doble clic aquí o pulsa + Franja para crear un turno';
        position: absolute;
        left: 16px;
        top: 36px;
        color: #98a3aa;
        font-size: 11px;
        font-weight: 700;
        pointer-events: none
    }

.horarios-track-row.local .horarios-sticky {
    background: #fffaf9
}

.horarios-track-row.local .horarios-track-area {
    height: 110px;
    background: repeating-linear-gradient(to right,#fff8f9 0,19px,#ece2e4 19px,#ece2e4 20px)
}

.horarios-local-block {
    position: absolute;
    top: 13px;
    height: 78px;
    border: 2px dashed #ddb6bd;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 5px 12px rgba(160,94,104,.11);
    overflow: hidden;
    min-width: 16px
}

.horarios-local-inner {
    display: flex;
    width: 100%;
    height: 100%
}

.horarios-local-segment {
    height: 100%;
    padding: 7px 8px;
    border-right: 1px solid rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    overflow: hidden
}

    .horarios-local-segment.assigned {
        background: #f5fbfb
    }

    .horarios-local-segment.unassigned {
        background: repeating-linear-gradient(135deg,#f8ecef,#f8ecef 10px,#fcf5f6 10px,#fcf5f6 20px)
    }

.horarios-local-time {
    font-size: 10px;
    font-weight: 900;
    color: #4e5860;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.horarios-local-pills {
    display: flex;
    gap: 3px;
    flex-wrap: wrap
}

.horarios-local-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    font-size: 9px;
    font-weight: 900
}

.horarios-local-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 16px;
    background: rgba(255,255,255,.35);
    cursor: ew-resize;
    z-index: 5
}

    .horarios-local-handle.left {
        left: 0
    }

    .horarios-local-handle.right {
        right: 0
    }

.horarios-clip {
    position: absolute;
    top: 20px;
    height: 46px;
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 5px 13px rgba(0,0,0,.16);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    font-weight: 900;
    font-size: 12px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.48)
}

    .horarios-clip.dragging {
        opacity: .88;
        cursor: grabbing
    }

    .horarios-clip.outside {
        outline: 3px solid rgba(213,147,20,.30);
        outline-offset: 2px
    }

.horarios-handle-left, .horarios-handle-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 9px;
    background: rgba(255,255,255,.28);
    cursor: ew-resize
}

.horarios-handle-left {
    left: 0
}

.horarios-handle-right {
    right: 0
}

.horarios-clip-text {
    pointer-events: none;
    padding: 0 12px;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0,0,0,.18)
}

.horarios-summary {
    display: grid;
    grid-template-columns: repeat(4,minmax(150px,1fr));
    gap: 8px;
    margin-top: 10px
}

.horarios-stat {
    background: #fff;
    border: 1px solid var(--h-line);
    border-radius: 10px;
    padding: 10px
}

    .horarios-stat span {
        display: block;
        color: var(--h-muted);
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase
    }

    .horarios-stat strong {
        font-size: 19px
    }

    .horarios-stat.warn {
        background: #fff9ed;
        border-color: #efd6a3
    }

        .horarios-stat.warn strong {
            color: #9a6500
        }

    .horarios-stat small {
        display: block;
        margin-top: 3px
    }

.horarios-overview {
    overflow: auto
}

.horarios-week-grid {
    display: grid;
    grid-template-columns: repeat(7,minmax(210px,1fr));
    gap: 10px;
    min-width: 1540px
}

.horarios-week-card {
    background: #fff;
    border: 1px solid var(--h-line);
    border-radius: 12px;
    min-height: 278px;
    padding: 11px;
    box-shadow: var(--h-shadow);
    cursor: pointer
}

    .horarios-week-card:hover {
        border-color: #9dcfca
    }

    .horarios-week-card.outside {
        opacity: .38;
        cursor: default
    }

    .horarios-week-card .wd {
        font-weight: 900
    }

    .horarios-week-card .date {
        font-size: 11px;
        color: var(--h-muted);
        margin-bottom: 8px
    }

.horarios-local-summary {
    background: #fff4f5;
    border: 1px dashed #ddb6bd;
    border-radius: 7px;
    padding: 6px;
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 8px
}

.horarios-overview-emp {
    margin: 5px 0
}

.horarios-overview-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 900
}

.horarios-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

.horarios-overview-shifts {
    font-size: 10px;
    color: var(--h-muted);
    padding-left: 13px
}

.horarios-overview-gap {
    font-size: 10px;
    color: #9a6500;
    background: #fff7e7;
    border-radius: 6px;
    padding: 3px 5px;
    margin-top: 6px
}

.horarios-month {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 1540px
}

.horarios-month-week {
    background: #eef2f4;
    border: 1px solid #e0e7ea;
    border-radius: 13px;
    padding: 9px
}

.horarios-month-caption {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--h-muted);
    margin: 0 2px 7px;
    display: flex;
    justify-content: space-between
}

.horarios-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13,23,32,.52);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px
}

.horarios-modal {
    max-width: 680px;
    width: 100%;
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 25px 70px rgba(0,0,0,.25)
}

.horarios-modal-list {
    background: #fff8eb;
    border: 1px solid #efd7a7;
    border-radius: 9px;
    padding: 10px;
    margin: 10px 0;
    max-height: 260px;
    overflow: auto
}

.horarios-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px
}

@media(max-width:1150px) {
    .horarios-summary {
        grid-template-columns: repeat(2,1fr)
    }
}

@media(max-width:650px) {
    .horarios-summary {
        grid-template-columns: 1fr
    }

    .horarios-page {
        --h-label: 250px
    }

    .horarios-header {
        display: block
    }

    .horarios-week-grid, .horarios-month {
        min-width: 1220px
    }
}


/* Solo empleados con 3 iniciales: fuente ligeramente menor.
   Los avatares de 1-2 iniciales conservan exactamente el estilo anterior. */
.horarios-avatar.horarios-avatar-3 {
    font-size: 10px;
    letter-spacing: -0.03em;
}

.horarios-track-label .horarios-avatar.horarios-avatar-3 {
    font-size: 11px;
}

.horarios-local-pill.horarios-local-pill-3 {
    font-size: 8px;
    letter-spacing: -0.03em;
    padding-left: 4px;
    padding-right: 4px;
}


/* =========================================================
   EDITOR DIARIO V2 · bandeja horizontal de empleados
   ========================================================= */

.horarios-page {
    --h-label: 305px;
}

.horarios-day-workspace {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.horarios-unassigned-strip {
    background: #fff;
    border: 1px solid var(--h-line);
    border-radius: 12px;
    box-shadow: var(--h-shadow);
    overflow: hidden;
}

    .horarios-unassigned-strip.empty {
        box-shadow: none;
    }

.horarios-unassigned-head {
    min-height: 48px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.horarios-unassigned-title {
    min-width: 180px;
    margin-right: auto;
}

.horarios-search-inline {
    width: 220px;
    margin: 0;
    flex: 0 1 220px;
}

.horarios-unassigned-toggle {
    width: 38px;
    font-weight: 900;
}

.horarios-unassigned-body {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 10px 10px;
    scrollbar-width: thin;
}

.horarios-emp-card-horizontal {
    flex: 0 0 285px;
    min-width: 285px;
    margin: 0;
    padding: 7px 8px;
}

    .horarios-emp-card-horizontal .horarios-avatar {
        width: 32px;
        height: 32px;
    }

.horarios-emp-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

    .horarios-emp-name-row strong {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.horarios-timeline-card {
    width: 100%;
    min-width: 0;
}

.horarios-track-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.15;
    max-height: 2.3em;
}

.horarios-track-label {
    padding-left: 10px;
    padding-right: 8px;
}

.horarios-track-actions {
    flex: 0 0 auto;
}

.horarios-editor-screen-warning {
    display: none;
    background: #fff8e8;
    border: 1px solid #efd6a3;
    border-radius: 12px;
    padding: 14px;
    color: #6d561a;
}

@media (max-width: 900px) {
    .horarios-editor-screen-warning {
        display: block;
    }

    .horarios-day-workspace {
        display: none;
    }
}


/* =========================================================
   RAIL COLAPSABLE DE PISTAS
   ========================================================= */

.horarios-ruler-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

    .horarios-ruler-label.compact {
        padding: 5px;
        justify-content: center;
    }

.horarios-rail-toggle {
    width: 30px;
    height: 28px;
    border: 1px solid #cbd6dc;
    border-radius: 7px;
    background: #fff;
    color: #31414b;
    font-size: 18px;
    line-height: 1;
    font-weight: 900;
    cursor: pointer;
    flex: 0 0 auto;
}

    .horarios-rail-toggle:hover {
        background: #eef4f6;
    }

.horarios-track-label {
    transition: width .16s ease;
}

    .horarios-track-label.compact {
        padding: 5px;
        justify-content: center;
        gap: 0;
        position: sticky;
        overflow: visible;
    }

        .horarios-track-label.compact .horarios-avatar {
            width: 40px;
            height: 40px;
            margin: 0;
        }

.horarios-avatar-clickable {
    width: 48px;
    min-width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
}

    .horarios-avatar-clickable:hover {
        background: #eef4f6;
    }

    .horarios-avatar-clickable:focus {
        outline: 2px solid #59bfc0;
        outline-offset: 2px;
    }

.horarios-track-popover {
    position: absolute;
    left: calc(100% + 8px);
    top: 8px;
    width: 275px;
    padding: 12px;
    background: #fff;
    border: 1px solid #cfdce2;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(13,30,42,.18);
    z-index: 40;
    color: #15222b;
    text-align: left;
}

    .horarios-track-popover::before {
        content: "";
        position: absolute;
        left: -7px;
        top: 18px;
        width: 12px;
        height: 12px;
        background: #fff;
        border-left: 1px solid #cfdce2;
        border-bottom: 1px solid #cfdce2;
        transform: rotate(45deg);
    }

.horarios-track-popover-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 7px;
}

    .horarios-track-popover-head strong {
        flex: 1;
        min-width: 0;
        line-height: 1.2;
    }

.horarios-popover-close {
    border: 0;
    background: transparent;
    color: #6d7a82;
    font-size: 20px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.horarios-track-popover-text {
    font-size: 12px;
    color: #5f6d76;
    line-height: 1.35;
    margin-bottom: 4px;
}

.horarios-track-popover-actions {
    display: flex;
    gap: 7px;
    margin-top: 10px;
}

/* El popover debe poder verse por encima de la timeline. */
.horarios-scroll,
.horarios-timeline,
.horarios-track-row {
    overflow: visible;
}

/* El scroll horizontal sigue perteneciendo a la tarjeta exterior.
   Se conserva su barra mediante overflow-x. */
.horarios-scroll {
    overflow-x: auto;
    overflow-y: visible;
}


/* =========================================================
   UNIDAD MENSUAL · navegación interna por semanas
   ========================================================= */

.horarios-week-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    color: #53636d;
    font-size: 12px;
    font-weight: 800;
}

    .horarios-week-selector span {
        min-width: 205px;
        text-align: center;
    }

.horarios-day.outside-month {
    background: #eef2f4;
    border-color: #dde4e8;
    box-shadow: none;
    cursor: default;
    opacity: .55;
}

.horarios-week-card.outside-month-empty {
    background: #f3f6f7;
    border-color: #e1e7ea;
    box-shadow: none;
    cursor: default;
    opacity: .5;
}

    .horarios-week-card.outside-month-empty:hover {
        border-color: #e1e7ea;
    }


/* =========================================================
   COMPARACIÓN ENTRE PUBLICACIONES MENSUALES
   ========================================================= */

.horarios-version-changes {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #d8e3e7;
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(13,30,42,.05);
}

.horarios-version-changes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

    .horarios-version-changes-head > div:first-child {
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
    }

    .horarios-version-changes-head strong {
        font-size: 14px;
    }

    .horarios-version-changes-head span {
        font-size: 12px;
        color: #687680;
    }

.horarios-version-changes-count {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e9f6f1;
    color: #176846;
    font-size: 12px;
    font-weight: 800;
}

.horarios-version-changes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.horarios-version-change-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 245px;
    padding: 7px 9px;
    border: 1px solid #dce6ea;
    border-radius: 9px;
    background: #f9fbfc;
}

.horarios-version-change-initials {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #20333e;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.horarios-version-change-item > div {
    min-width: 0;
    flex: 1;
}

.horarios-version-change-item strong {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

.horarios-version-change-item small {
    display: block;
    color: #687680;
    font-size: 11px;
}

.horarios-version-changes-empty {
    padding: 7px 9px;
    border-radius: 8px;
    background: #f4f7f8;
    color: #586770;
    font-size: 13px;
}

.horarios-version-changes-foot {
    margin-top: 8px;
    color: #74818a;
    font-size: 11px;
}

@media (max-width: 900px) {
    .horarios-version-changes-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .horarios-version-change-item {
        min-width: 100%;
    }
}


/* =========================================================
   VACACIONES EN PLANIFICACIÓN
   ========================================================= */

.horarios-clip.vacation {
    cursor: default;
    border-style: dashed;
    border-color: rgba(255,255,255,.72);
    box-shadow: 0 4px 12px rgba(0,0,0,.13);
    touch-action: auto;
}

    .horarios-clip.vacation .horarios-clip-text {
        letter-spacing: .045em;
        text-shadow: 0 1px 1px rgba(0,0,0,.22);
    }

.horarios-overview-shifts.vacation {
    color: #8a5c00;
    font-weight: 800;
    letter-spacing: .025em;
}

.horarios-vacation-button.active {
    color: #765100;
    background: #fff4cf;
    border-color: #dfbd5a;
}

.horarios-vacation-dates {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}

.horarios-vacation-actions {
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 650px) {
    .horarios-vacation-dates {
        grid-template-columns: 1fr;
    }

    .horarios-vacation-actions .me-auto {
        width: 100%;
        margin-right: 0 !important;
    }
}

/* =========================================================
   PISTA DE EMPLEADO · ACCIONES EN SEGUNDA FILA
   Evita que + Franja / Vacaciones / quitar aplasten nombre
   y datos dentro del rail de 270 px.
   ========================================================= */

.horarios-track-row:not(.local) .horarios-track-label:not(.compact) {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    column-gap: 8px;
    row-gap: 5px;
    min-height: 142px;
    padding: 7px 8px;
}

    .horarios-track-row:not(.local) .horarios-track-label:not(.compact) > .horarios-avatar {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }

    .horarios-track-row:not(.local) .horarios-track-label:not(.compact) > .horarios-track-meta {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        min-width: 0;
    }

    .horarios-track-row:not(.local) .horarios-track-label:not(.compact) > .horarios-track-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        min-width: 0;
        margin-left: 0;
        display: grid;
        grid-template-columns: max-content max-content;
        grid-auto-rows: minmax(27px, auto);
        align-items: center;
        justify-content: start;
        gap: 5px 6px;
        overflow: visible;
    }

        .horarios-track-row:not(.local) .horarios-track-label:not(.compact) > .horarios-track-actions .btn {
            min-width: 0;
            padding: .22rem .44rem;
            font-size: 10.5px;
            line-height: 1.2;
            white-space: nowrap;
        }

        .horarios-track-row:not(.local) .horarios-track-label:not(.compact) > .horarios-track-actions .btn-outline-danger {
            width: 32px;
            min-width: 32px;
            padding-left: .3rem;
            padding-right: .3rem;
        }

.horarios-track-actions .horarios-libranza-button {
    color: #6f42c1 !important;
    border: 1px solid #6f42c1 !important;
    background: #fff !important;
    border-radius: .25rem;
}

    .horarios-track-actions .horarios-libranza-button:hover,
    .horarios-track-actions .horarios-libranza-button:focus {
        color: #fff !important;
        background: #6f42c1 !important;
        border-color: #6f42c1 !important;
    }

.horarios-track-actions .btn:disabled,
.horarios-track-actions .btn.disabled {
    color: #8a949d !important;
    background: #f5f7f8 !important;
    border-color: #c9d0d5 !important;
    opacity: 1;
    box-shadow: none;
}

.horarios-track-row:not(.local) .horarios-track-area {
    height: 142px;
}

.horarios-track-row:not(.local) .horarios-clip {
    top: 29px;
}

.horarios-track-row:not(.local) .horarios-track-area.empty:after {
    top: 44px;
}

/* =========================================================
   COMPARACIÓN ENTRE VERSIONES · PLEGAR / DESPLEGAR
   ========================================================= */

.horarios-version-changes-controls {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.horarios-version-changes-toggle {
    width: 34px;
    min-width: 34px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    line-height: 1;
}

/* =========================================================
   HORARIO DEL LOCAL · HORA EN VIVO AL REDIMENSIONAR
   ========================================================= */

.horarios-local-resize-text {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 9;
    transform: translate(-50%, -50%);
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(31, 44, 52, .90);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.horarios-local-block.resizing .horarios-local-resize-text {
    display: block;
}

.horarios-local-block.resizing .horarios-local-inner {
    opacity: .28;
}

.horarios-local-block.resizing {
    cursor: ew-resize;
}

/* =========================================================
   HORARIO DEL LOCAL · AJUSTE V5
   La lectura del intervalo durante el resize se centra sobre
   la franja y usa la misma escala visual que la regleta.
   ========================================================= */

.horarios-local-block.resizing {
    outline: 2px solid rgba(31, 44, 52, .28);
    outline-offset: 1px;
}

    .horarios-local-block.resizing .horarios-local-resize-text {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

/* =========================================================
   HORARIO DEL LOCAL · AJUSTE V6
   ========================================================= */

.horarios-local-block {
    box-sizing: border-box;
}

    .horarios-local-block.resizing .horarios-local-resize-text {
        top: 50%;
        transform: translateY(-50%);
        max-width: calc(100% - 40px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .horarios-local-block.resizing-left .horarios-local-resize-text {
        left: 18px;
        right: auto;
    }

    .horarios-local-block.resizing-right .horarios-local-resize-text {
        left: auto;
        right: 18px;
    }

/* =========================================================
   CAMBIOS SIN GUARDAR · MODAL DE SALIDA
   ========================================================= */

.horarios-unsaved-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 18, 26, .68);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.horarios-unsaved-dialog {
    width: min(620px, calc(100vw - 32px));
    padding: 28px 30px 24px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(24, 44, 56, .14);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
    text-align: center;
}

.horarios-unsaved-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff2c7;
    border: 2px solid #e1af24;
    color: #8b5c00;
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
}

.horarios-unsaved-title {
    margin-bottom: 8px;
    color: #142936;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.15;
}

.horarios-unsaved-text {
    max-width: 520px;
    margin: 0 auto;
    color: #485861;
    font-size: 16px;
    line-height: 1.45;
}

.horarios-unsaved-highlight {
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff8e1;
    border: 1px solid #efd788;
    color: #6f5510;
    font-size: 14px;
    font-weight: 700;
}

.horarios-unsaved-actions {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

    .horarios-unsaved-actions .btn {
        min-height: 42px;
        padding-left: 18px;
        padding-right: 18px;
        font-weight: 700;
    }

@media (max-width: 700px) {
    .horarios-unsaved-overlay {
        padding: 14px;
    }

    .horarios-unsaved-dialog {
        padding: 22px 18px 18px;
    }

    .horarios-unsaved-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

        .horarios-unsaved-actions .btn {
            width: 100%;
        }
}

/* =========================================================
   COMPARACIÓN EN VIVO DEL BORRADOR
   ========================================================= */

.horarios-version-changes.pending {
    border-color: #ead59b;
    background: #fffdf7;
}

.horarios-version-changes-count.pending {
    background: #fff0c7;
    color: #7a5600;
}

.horarios-version-changes.pending .horarios-version-changes-head > div:first-child > span {
    color: #8a6a17;
    font-weight: 700;
}

/* =========================================================
   COMPARACIÓN · EMPLEADOS INCLUIDOS SIN CAMBIOS
   ========================================================= */

.horarios-version-unchanged {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e8edf0;
}

.horarios-version-unchanged-title {
    margin-bottom: 7px;
    color: #5b6971;
    font-size: 12px;
    font-weight: 800;
}

.horarios-version-unchanged-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.horarios-version-unchanged-item {
    min-width: 230px;
    max-width: 330px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid #dfe7eb;
    border-radius: 9px;
    background: #f8fafb;
    color: #30434e;
}

    .horarios-version-unchanged-item > div {
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .horarios-version-unchanged-item strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
    }

    .horarios-version-unchanged-item small {
        color: #74828a;
        font-size: 10px;
    }



/* =========================================================
   COMPARACIÓN · REFUERZO VISUAL SIN CAMBIOS V10.4
   ========================================================= */

.horarios-version-unchanged {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e3e9ed;
}

.horarios-version-unchanged-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #607078;
    font-size: 12px;
    font-weight: 800;
}

.horarios-version-unchanged-list {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
}

.horarios-version-unchanged-item {
    display: flex !important;
    align-items: center;
    gap: 9px;
    min-width: 240px;
    max-width: 360px;
    padding: 8px 10px;
    border: 1px solid #dbe4e8;
    border-radius: 10px;
    background: #f7f9fa;
}

    .horarios-version-unchanged-item > div {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .horarios-version-unchanged-item strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #1d2d36;
        font-size: 12px;
        line-height: 1.2;
    }

    .horarios-version-unchanged-item small {
        display: block;
        margin-top: 2px;
        color: #738089;
        font-size: 10px;
        line-height: 1.2;
    }




/* Empleados de prueba: ocultos por defecto en la planificación habitual. */
.horarios-test-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
    padding: .35rem .55rem;
    border: 1px solid #dfe7ea;
    border-radius: 9px;
    background: #fff;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

    /*
       Control propio: no usa .form-check ni .form-switch de Bootstrap.
       Así evitamos definitivamente sus márgenes negativos y el solape
       con el botón "Mes".
    */
    .horarios-test-toggle > input {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
        overflow: hidden;
        pointer-events: none;
    }

.horarios-test-toggle-ui {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex: 0 0 34px;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .14);
    transition: background-color .15s ease;
}

    .horarios-test-toggle-ui::before {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .28);
        transition: transform .15s ease;
    }

.horarios-test-toggle > input:checked + .horarios-test-toggle-ui {
    background: #0d6efd;
}

    .horarios-test-toggle > input:checked + .horarios-test-toggle-ui::before {
        transform: translateX(14px);
    }

.horarios-test-toggle > input:focus-visible + .horarios-test-toggle-ui {
    outline: 3px solid rgba(13, 110, 253, .25);
    outline-offset: 2px;
}

.horarios-test-toggle-text {
    margin: 0;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
}

/* R10 · Botonera de pista responsive */
@media (max-width: 650px) {
    .horarios-page {
        --h-label: 270px;
    }

    .horarios-track-row:not(.local) .horarios-track-label:not(.compact) {
        min-height: 150px;
    }

    .horarios-track-row:not(.local) .horarios-track-area {
        height: 150px;
    }

    .horarios-track-row:not(.local) .horarios-clip {
        top: 41px;
    }
}

/* R11 · Estado visual inequívoco del CTA de vacaciones bloqueado. */
.horarios-vacation-actions .btn-primary:disabled,
.horarios-vacation-actions .btn-primary.disabled {
    color: #6c757d !important;
    background: #e9ecef !important;
    border-color: #ced4da !important;
    opacity: 1 !important;
    box-shadow: none !important;
    cursor: not-allowed;
}




/* =========================================================
   R13 · BLOQUEO DE EDICIÓN EN TELÉFONO / PANTALLA ESTRECHA
   En móvil mostramos solo el aviso superior. No se renderiza
   visualmente comparación, empleados ni herramientas de edición.
   ========================================================= */
.horarios-mobile-blocker {
    display: none;
}

.horarios-editor-content {
    display: contents;
}

@media (max-width: 900px) {
    .horarios-header-actions {
        display: none !important;
    }

    .horarios-mobile-blocker {
        display: block;
        margin: 0 0 1rem 0;
        padding: 1rem;
        border: 1px solid #efd6a3;
        border-radius: 12px;
        background: #fff8e8;
        color: #6d561a;
        line-height: 1.45;
    }

        .horarios-mobile-blocker strong {
            display: block;
            margin-bottom: .35rem;
            color: #4c3a0f;
            font-size: 1rem;
        }

    .horarios-editor-content {
        display: none !important;
    }
}
