/* =====================================================
   CPCS ACCESS MANAGEMENT
===================================================== */

.cpcs-access-backdrop,
.cpcs-access-backdrop *{
    box-sizing:border-box;
}

.cpcs-access-backdrop{
    position:fixed;
    inset:0;
    z-index:12000;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    overflow:auto;
    background:rgba(15,23,42,.58);
    backdrop-filter:blur(5px);
    -webkit-backdrop-filter:blur(5px);
}

.cpcs-access-modal{
    width:min(1180px,100%);
    max-height:calc(100dvh - 48px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid #dbe3ee;
    border-radius:20px;
    background:#f8fafc;
    box-shadow:0 34px 90px rgba(15,23,42,.30);
    color:#0f172a;
}

.cpcs-access-header{
    position:relative;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:24px;
    padding:25px 30px 23px 34px;
    border-bottom:1px solid #e2e8f0;
    background:#fff;
}

.cpcs-access-header::before{
    content:"";
    position:absolute;
    inset:0 auto 0 0;
    width:4px;
    background:#2563eb;
}

.cpcs-access-header small,
.cpcs-access-section-heading small,
.cpcs-access-session-card small,
.cpcs-access-users-toolbar small,
.cpcs-user-editor header small{
    display:block;
    margin:0 0 5px;
    color:#2563eb;
    font-size:10px;
    font-weight:800;
    letter-spacing:.11em;
}

.cpcs-access-header h2{
    margin:0;
    font-size:24px;
    line-height:1.2;
    letter-spacing:-.02em;
}

.cpcs-access-header p,
.cpcs-access-session-card p,
.cpcs-access-users-toolbar p,
.cpcs-user-editor header p{
    margin:6px 0 0;
    color:#64748b;
    font-size:12px;
    line-height:1.55;
}

.cpcs-access-close,
.cpcs-user-editor header button{
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid #e2e8f0;
    border-radius:10px;
    background:#fff;
    color:#64748b;
    cursor:pointer;
}

.cpcs-access-close:hover,
.cpcs-user-editor header button:hover{
    background:#f8fafc;
    color:#0f172a;
}

.cpcs-access-close svg,
.cpcs-user-editor header button svg{
    width:18px;
    height:18px;
}

.cpcs-access-body{
    min-height:0;
    overflow:auto;
    display:grid;
    gap:18px;
    padding:22px;
}

.cpcs-access-company-card,
.cpcs-access-session-card,
.cpcs-access-users-card{
    border:1px solid #e2e8f0;
    border-radius:16px;
    background:#fff;
    box-shadow:0 3px 14px rgba(15,23,42,.035);
}

.cpcs-access-company-card{
    padding:20px;
}

.cpcs-access-section-heading{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:16px;
}

.cpcs-access-section-heading h3,
.cpcs-access-session-card h3,
.cpcs-access-users-toolbar h3,
.cpcs-user-editor h3{
    margin:0;
    color:#0f172a;
    font-size:17px;
    line-height:1.3;
}

.cpcs-access-section-heading > svg{
    width:22px;
    height:22px;
    color:#2563eb;
}

.cpcs-access-company-form{
    display:grid;
    grid-template-columns:minmax(0,1.5fr) minmax(180px,.8fr) auto;
    gap:14px;
    align-items:end;
}

.cpcs-access-company-form label,
.cpcs-user-form-grid label{
    display:flex;
    flex-direction:column;
    gap:7px;
    min-width:0;
}

.cpcs-access-company-form label > span,
.cpcs-user-form-grid label > span{
    color:#334155;
    font-size:11px;
    font-weight:750;
}

.cpcs-access-company-form input,
.cpcs-access-session-control select,
.cpcs-user-form-grid input,
.cpcs-user-form-grid select{
    width:100%;
    height:43px;
    padding:0 13px;
    border:1px solid #cbd5e1;
    border-radius:9px;
    outline:none;
    background:#fff;
    color:#0f172a;
    font:inherit;
    font-size:13px;
}

.cpcs-access-company-form input:focus,
.cpcs-access-session-control select:focus,
.cpcs-user-form-grid input:focus,
.cpcs-user-form-grid select:focus{
    border-color:#2563eb;
    box-shadow:0 0 0 3px rgba(37,99,235,.10);
}

.cpcs-access-company-form input[readonly]{
    background:#f8fafc;
    color:#64748b;
}

.cpcs-access-session-card{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:28px;
    padding:18px 20px;
    border-color:#bfdbfe;
    background:linear-gradient(135deg,#eff6ff,#fff 55%);
}

.cpcs-access-session-control{
    min-width:min(430px,48%);
    display:flex;
    align-items:center;
    gap:10px;
}

.cpcs-access-users-card{
    overflow:hidden;
}

.cpcs-access-users-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:22px;
    padding:20px;
    border-bottom:1px solid #e2e8f0;
}

.cpcs-access-primary,
.cpcs-access-secondary{
    min-height:40px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:0 16px;
    border-radius:9px;
    font-size:12px;
    font-weight:750;
    cursor:pointer;
    white-space:nowrap;
}

.cpcs-access-primary{
    border:1px solid #2563eb;
    background:#2563eb;
    color:#fff;
    box-shadow:0 5px 14px rgba(37,99,235,.18);
}

.cpcs-access-primary:hover{
    border-color:#1d4ed8;
    background:#1d4ed8;
}

.cpcs-access-secondary{
    border:1px solid #cbd5e1;
    background:#fff;
    color:#334155;
}

.cpcs-access-secondary:hover{
    border-color:#94a3b8;
    background:#f8fafc;
    color:#0f172a;
}

.cpcs-access-primary svg,
.cpcs-access-secondary svg{
    width:15px;
    height:15px;
}

.cpcs-access-table-wrap{
    width:100%;
    overflow:auto;
}

.cpcs-access-table{
    width:100%;
    min-width:780px;
    border-collapse:collapse;
}

.cpcs-access-table th{
    padding:11px 16px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
    color:#64748b;
    font-size:10px;
    font-weight:800;
    letter-spacing:.06em;
    text-align:left;
    text-transform:uppercase;
}

.cpcs-access-table td{
    padding:13px 16px;
    border-bottom:1px solid #eef2f7;
    color:#334155;
    font-size:12px;
    vertical-align:middle;
}

.cpcs-access-table tbody tr:last-child td{
    border-bottom:0;
}

.cpcs-access-user-cell{
    display:flex;
    align-items:center;
    gap:11px;
    min-width:190px;
}

.cpcs-access-user-cell strong{
    display:block;
    color:#0f172a;
    font-size:12px;
}

.cpcs-access-user-cell small{
    display:block;
    margin-top:3px;
    color:#94a3b8;
    font-size:10px;
}

.cpcs-access-avatar{
    width:34px;
    height:34px;
    flex:0 0 34px;
    display:grid;
    place-items:center;
    border-radius:10px;
    background:#eff6ff;
    color:#2563eb;
    font-size:11px;
    font-weight:800;
}

.cpcs-role-pill,
.cpcs-project-scope{
    display:inline-flex;
    align-items:center;
    min-height:27px;
    padding:4px 8px;
    border:1px solid #e2e8f0;
    border-radius:7px;
    background:#f8fafc;
    color:#475569;
    font-size:10px;
    font-weight:700;
}

.cpcs-project-scope{
    max-width:260px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.am-status{
    display:inline-flex;
    align-items:center;
    gap:6px;
    font-size:10px;
    font-weight:750;
}

.am-status > span{
    width:7px;
    height:7px;
    border-radius:50%;
}

.am-status.is-active{color:#15803d;}
.am-status.is-active > span{background:#22c55e;}
.am-status.is-inactive{color:#64748b;}
.am-status.is-inactive > span{background:#94a3b8;}

.cpcs-access-row-actions{
    width:94px;
    text-align:right;
    white-space:nowrap;
}

.cpcs-access-row-actions button{
    width:31px;
    height:31px;
    display:inline-grid;
    place-items:center;
    margin-left:5px;
    padding:0;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
    color:#64748b;
    cursor:pointer;
}

.cpcs-access-row-actions button:hover{
    border-color:#cbd5e1;
    background:#f8fafc;
    color:#2563eb;
}

.cpcs-access-row-actions svg{
    width:14px;
    height:14px;
}

/* User editor */
.cpcs-user-editor-backdrop{
    position:absolute;
    inset:0;
    z-index:2;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:22px;
    background:rgba(15,23,42,.34);
    backdrop-filter:blur(2px);
}

.cpcs-access-modal{position:relative;}

.cpcs-user-editor{
    width:min(760px,100%);
    max-height:calc(100dvh - 90px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid #dbe3ee;
    border-radius:17px;
    background:#fff;
    box-shadow:0 26px 70px rgba(15,23,42,.26);
}

.cpcs-user-editor header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:20px;
    padding:20px 22px;
    border-bottom:1px solid #e2e8f0;
}

.cpcs-user-editor-body{
    min-height:0;
    overflow:auto;
    padding:22px;
}

.cpcs-user-form-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px;
}

.cpcs-assignment-section{
    margin-top:22px;
    padding-top:20px;
    border-top:1px solid #e2e8f0;
}

.cpcs-assignment-heading{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
    margin-bottom:14px;
}

.cpcs-assignment-heading strong{
    display:block;
    color:#0f172a;
    font-size:12px;
}

.cpcs-assignment-heading small{
    display:block;
    margin-top:4px;
    color:#64748b;
    font-size:10px;
}

.cpcs-all-projects-toggle{
    display:flex;
    align-items:center;
    gap:8px;
    color:#334155;
    font-size:11px;
    font-weight:750;
    cursor:pointer;
}

.cpcs-project-assignment-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
}

.cpcs-project-assignment{
    min-width:0;
    display:flex;
    align-items:flex-start;
    gap:10px;
    padding:12px;
    border:1px solid #e2e8f0;
    border-radius:10px;
    background:#f8fafc;
    cursor:pointer;
}

.cpcs-project-assignment:hover{
    border-color:#bfdbfe;
    background:#eff6ff;
}

.cpcs-project-assignment input{
    margin-top:2px;
}

.cpcs-project-assignment span{
    min-width:0;
}

.cpcs-project-assignment strong{
    display:block;
    color:#0f172a;
    font-size:11px;
}

.cpcs-project-assignment small{
    display:block;
    margin-top:3px;
    overflow:hidden;
    color:#64748b;
    font-size:10px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.cpcs-assignment-empty{
    grid-column:1 / -1;
    padding:18px;
    border:1px dashed #cbd5e1;
    border-radius:10px;
    color:#64748b;
    font-size:11px;
    text-align:center;
}

.cpcs-user-editor footer{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    padding:14px 22px;
    border-top:1px solid #e2e8f0;
    background:#f8fafc;
}

@media(max-width:820px){
    .cpcs-access-backdrop{
        align-items:flex-start;
        padding:12px;
    }

    .cpcs-access-modal{
        max-height:calc(100dvh - 24px);
        border-radius:16px;
    }

    .cpcs-access-company-form{
        grid-template-columns:1fr 1fr;
    }

    .cpcs-access-company-form .cpcs-access-secondary{
        grid-column:1 / -1;
        justify-self:start;
    }

    .cpcs-access-session-card{
        align-items:flex-start;
        flex-direction:column;
    }

    .cpcs-access-session-control{
        width:100%;
        min-width:0;
    }
}

@media(max-width:600px){
    .cpcs-access-backdrop{
        padding:6px;
    }

    .cpcs-access-modal{
        max-height:calc(100dvh - 12px);
        border-radius:13px;
    }

    .cpcs-access-header{
        padding:18px 16px 16px 20px;
    }

    .cpcs-access-header h2{
        font-size:20px;
    }

    .cpcs-access-body{
        gap:12px;
        padding:12px;
    }

    .cpcs-access-company-form,
    .cpcs-user-form-grid,
    .cpcs-project-assignment-grid{
        grid-template-columns:1fr;
    }

    .cpcs-access-company-form .cpcs-access-secondary{
        width:100%;
    }

    .cpcs-access-session-control{
        align-items:stretch;
        flex-direction:column;
    }

    .cpcs-access-users-toolbar{
        align-items:stretch;
        flex-direction:column;
    }

    .cpcs-access-users-toolbar .cpcs-access-primary{
        width:100%;
    }

    .cpcs-user-editor-backdrop{
        align-items:flex-start;
        padding:8px;
    }

    .cpcs-user-editor{
        max-height:calc(100dvh - 16px);
        border-radius:13px;
    }

    .cpcs-user-editor header,
    .cpcs-user-editor-body,
    .cpcs-user-editor footer{
        padding-left:16px;
        padding-right:16px;
    }

    .cpcs-assignment-heading{
        flex-direction:column;
    }

    .cpcs-user-editor footer{
        flex-direction:column-reverse;
    }

    .cpcs-user-editor footer button{
        width:100%;
    }
}
