/* ==========================================================
   DELICA - CHIA CA
   ========================================================== */

.shift-allocation-modal{
    position:fixed;
    inset:0;
    z-index:99990;
    display:none;
    align-items:center;
    justify-content:center;
    padding:20px;
    background:rgba(15,23,42,.68);
}

.shift-allocation-panel{
    width:min(1080px,96vw);
    max-height:92vh;
    overflow:auto;
    background:#fff;
    border-radius:18px;
    box-shadow:0 24px 70px rgba(0,0,0,.28);
}

.shift-allocation-header{
    display:flex;
    justify-content:space-between;
    gap:20px;
    padding:20px 24px;
    background:linear-gradient(135deg,#d92323,#ef3b32);
    color:#fff;
}

.shift-allocation-header h2{
    margin:4px 0 3px;
    font-size:25px;
}

.shift-allocation-header p{
    margin:0;
    opacity:.9;
    font-size:13px;
}

.shift-allocation-kicker,
.shift-allocation-section-kicker{
    font-size:10px;
    font-weight:800;
    letter-spacing:.08em;
}

.shift-allocation-close{
    border:0;
    background:transparent;
    color:#fff;
    font-size:30px;
    line-height:1;
    cursor:pointer;
    align-self:flex-start;
}

.shift-allocation-toolbar{
    display:flex;
    align-items:end;
    gap:12px;
    padding:16px 20px;
    border-bottom:1px solid #eee;
    background:#fff;
}

.shift-allocation-toolbar label,
.shift-allocation-form-grid label{
    display:flex;
    flex-direction:column;
    gap:6px;
    min-width:0;
}

.shift-allocation-toolbar label span,
.shift-allocation-form-grid label span{
    font-size:12px;
    font-weight:700;
    color:#475569;
}

.shift-allocation-toolbar input,
.shift-allocation-form-grid select{
    min-height:42px;
    border:1px solid #d7dce5;
    border-radius:9px;
    padding:0 11px;
    background:#fff;
    font-size:14px;
    outline:none;
}

.shift-allocation-toolbar input:focus,
.shift-allocation-form-grid select:focus{
    border-color:#d92323;
}

.shift-allocation-primary,
.shift-allocation-save{
    min-height:42px;
    border:0;
    border-radius:9px;
    padding:0 18px;
    color:#fff;
    background:#d92323;
    font-weight:800;
    cursor:pointer;
}

.shift-allocation-primary:hover,
.shift-allocation-save:hover{
    background:#b91c1c;
}

.shift-allocation-reference,
.shift-allocation-form-section{
    margin:16px 20px;
    border:1px solid #e5e7eb;
    border-radius:14px;
    overflow:hidden;
}

.shift-allocation-section-title{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:center;
    padding:13px 15px;
    background:#f8fafc;
    border-bottom:1px solid #e5e7eb;
}

.shift-allocation-section-title h3{
    margin:2px 0 0;
    font-size:17px;
    color:#111827;
}

.shift-allocation-section-title span:last-child{
    color:#64748b;
    font-size:12px;
}

.shift-allocation-reference-body{
    padding:12px;
}

.shift-allocation-reference-row{
    display:grid;
    grid-template-columns:190px 1fr;
    gap:15px;
    padding:13px 5px;
    border-bottom:1px solid #f0f2f5;
}

.shift-allocation-reference-row:last-child{
    border-bottom:0;
}

.shift-allocation-reference-shift{
    display:flex;
    flex-direction:column;
    gap:3px;
}

.shift-allocation-reference-shift b{
    font-size:14px;
}

.shift-allocation-reference-shift small{
    color:#64748b;
}

.shift-allocation-reference-people{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    align-items:center;
}

.shift-allocation-person{
    border:1px solid #dbe2ea;
    border-radius:999px;
    padding:7px 10px;
    background:#fff;
    color:#1f2937;
    cursor:pointer;
    font-size:13px;
}

.shift-allocation-person:hover{
    border-color:#d92323;
    color:#b91c1c;
}

.shift-allocation-no-person,
.shift-allocation-empty{
    color:#94a3b8;
    font-size:13px;
}

.shift-allocation-form-grid{
    display:grid;
    grid-template-columns:2fr 1fr 1fr 1.4fr;
    gap:12px;
    padding:16px;
}

.shift-allocation-form-meta{
    display:flex;
    justify-content:space-between;
    gap:12px;
    padding:0 16px 14px;
    color:#64748b;
    font-size:12px;
}

#shiftAllocationExistingStatus{
    color:#b45309;
    font-weight:700;
}

.shift-allocation-actions{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:13px 16px;
    border-top:1px solid #e5e7eb;
    background:#fafafa;
}

#shiftAllocationStatus{
    color:#166534;
    font-size:13px;
    font-weight:700;
}

.employee-admin-card-shift-allocation{
    background:linear-gradient(135deg,#fff7ed,#ffedd5);
}

@media(max-width:700px){
    .shift-allocation-modal{
        padding:0;
        align-items:stretch;
    }
    .shift-allocation-panel{
        width:100%;
        max-height:100vh;
        border-radius:0;
    }
    .shift-allocation-toolbar{
        flex-direction:column;
        align-items:stretch;
    }
    .shift-allocation-reference-row{
        grid-template-columns:1fr;
        gap:8px;
    }
    .shift-allocation-form-grid{
        grid-template-columns:1fr 1fr;
    }
    .shift-allocation-form-grid label:first-child,
    .shift-allocation-form-grid label:last-child{
        grid-column:1/-1;
    }
    .shift-allocation-form-meta,
    .shift-allocation-actions{
        flex-direction:column;
        align-items:stretch;
    }
    .shift-allocation-save{
        width:100%;
    }
}

/* Lịch đã lưu trong ngày — mỗi ca gọn trên 1 dòng */
.shift-allocation-existing{
    margin-top:18px;
    padding:14px;
    border:1px solid #dbe3ef;
    border-radius:14px;
    background:#f8fafc;
}
.shift-allocation-existing-body{
    display:flex;
    flex-direction:column;
    gap:6px;
}
.shift-allocation-existing-row{
    width:100%;
    display:flex;
    align-items:center;
    gap:10px;
    text-align:left;
    padding:8px 12px;
    border:1px solid #e2e8f0;
    border-radius:9px;
    background:#fff;
    cursor:pointer;
    font:inherit;
    color:#1f2937;
    min-width:0;
}
.shift-allocation-existing-row:hover{
    border-color:#93c5fd;
    background:#eff6ff;
}
.shift-allocation-existing-name{
    flex:1 1 auto;
    min-width:0;
    font-weight:700;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.shift-allocation-existing-time{
    flex:0 0 auto;
    font-weight:700;
    color:#334155;
    white-space:nowrap;
}
.shift-allocation-existing-branch{
    flex:0 1 150px;
    min-width:0;
    color:#64748b;
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
@media(max-width:500px){
    .shift-allocation-existing{
        padding:10px;
    }
    .shift-allocation-existing-row{
        gap:7px;
        padding:7px 9px;
    }
    .shift-allocation-existing-time{
        font-size:12px;
    }
    .shift-allocation-existing-branch{
        flex-basis:100px;
        font-size:11px;
    }
}

/* ==========================================================
   MULTI-ROW CHIA CA
   ========================================================== */
.shift-allocation-rows-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:14px 16px 10px;
    background:#fff;
}

.shift-allocation-rows-toolbar b{
    display:block;
    color:#111827;
    font-size:14px;
}

.shift-allocation-rows-toolbar small{
    display:block;
    margin-top:3px;
    color:#64748b;
    font-size:12px;
}

.shift-allocation-add-row{
    min-height:38px;
    padding:0 14px;
    border:1px solid #d92323;
    border-radius:9px;
    background:#fff;
    color:#d92323;
    font-weight:800;
    cursor:pointer;
    white-space:nowrap;
}

.shift-allocation-add-row:hover{
    background:#fff1f1;
}

.shift-allocation-rows{
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:0 16px 16px;
}

.shift-allocation-row{
    display:grid;
    grid-template-columns:38px minmax(230px,2fr) 110px 110px minmax(170px,1.3fr) 70px 38px;
    gap:9px;
    align-items:end;
    padding:12px;
    border:1px solid #e2e8f0;
    border-radius:11px;
    background:#f8fafc;
}

.shift-allocation-row label{
    display:flex;
    flex-direction:column;
    gap:5px;
    min-width:0;
}

.shift-allocation-row label span{
    font-size:11px;
    font-weight:700;
    color:#64748b;
}

.shift-allocation-row select{
    width:100%;
    min-height:40px;
    border:1px solid #d7dce5;
    border-radius:8px;
    padding:0 9px;
    background:#fff;
    font-size:13px;
    outline:none;
}

.shift-allocation-row select:focus{
    border-color:#d92323;
}

.shift-allocation-row-index{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    border-radius:8px;
    background:#fee2e2;
    color:#b91c1c;
    font-weight:900;
    font-size:12px;
}

.shift-allocation-row-hours{
    min-height:40px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:8px;
    background:#ecfdf5;
    color:#166534;
    font-size:12px;
    font-weight:800;
}

.shift-allocation-remove-row{
    width:38px;
    height:40px;
    border:1px solid #fecaca;
    border-radius:8px;
    background:#fff;
    color:#dc2626;
    font-size:22px;
    line-height:1;
    cursor:pointer;
}

.shift-allocation-remove-row:hover{
    background:#fef2f2;
}

@media(max-width:900px){
    .shift-allocation-row{
        grid-template-columns:34px 1fr 1fr;
    }
    .shift-allocation-row label:nth-of-type(1){
        grid-column:2 / 4;
    }
    .shift-allocation-row label:nth-of-type(2),
    .shift-allocation-row label:nth-of-type(3),
    .shift-allocation-row label:nth-of-type(4){
        grid-column:auto;
    }
    .shift-allocation-row-hours{
        grid-column:2;
    }
    .shift-allocation-remove-row{
        grid-column:3;
    }
}

@media(max-width:600px){
    .shift-allocation-rows-toolbar{
        align-items:stretch;
        flex-direction:column;
    }
    .shift-allocation-add-row{
        width:100%;
    }
    .shift-allocation-row{
        grid-template-columns:32px 1fr;
    }
    .shift-allocation-row label:nth-of-type(1),
    .shift-allocation-row label:nth-of-type(2),
    .shift-allocation-row label:nth-of-type(3),
    .shift-allocation-row label:nth-of-type(4),
    .shift-allocation-row-hours,
    .shift-allocation-remove-row{
        grid-column:2;
    }
    .shift-allocation-row-index{
        grid-column:1;
        grid-row:1;
        align-self:start;
    }
}
