.jbsm-app,.jbsm-login-card{font-family:system-ui,-apple-system,Segoe UI,sans-serif;background:#fff;border:1px solid #ddd;border-radius:14px;padding:18px;box-sizing:border-box}
.jbsm-head{display:flex;justify-content:space-between;align-items:center}.jbsm-head h2{margin:0}.jbsm-head button,.jbsm-tabs button,.jbsm-log-form button,.jbsm-login button{padding:9px 12px;border:1px solid #999;border-radius:8px;background:#fff;font-weight:700;cursor:pointer}
.jbsm-selectors{margin:15px 0;display:flex;gap:16px;flex-wrap:wrap}.jbsm-selectors label{font-weight:700}.jbsm-selectors select{margin-left:8px;padding:8px;border-radius:7px;min-width:180px}
.jbsm-tabs{display:flex;gap:8px;margin-bottom:15px;overflow:auto}.jbsm-tabs .active{background:#222;color:#fff}
.jbsm-table-wrap{overflow:auto;border:1px solid #ddd;border-radius:9px}table{border-collapse:collapse;width:100%}th,td{border:1px solid #ddd;padding:7px;text-align:left}th{background:#f5f5f5}
.jbsm-grade{min-width:1750px}.jbsm-grade th,.jbsm-grade td{text-align:center;padding:3px}.jbsm-grade .student{text-align:left;min-width:160px}.jbsm-grade .sep{border-left:4px solid #444}
.jbsm-grade-input{width:30px;text-align:center;padding:5px 1px;border:1px solid #aaa;border-radius:5px}.jbsm-label{width:55px;font-size:9px}
.jbsm-msg{padding:8px 10px;margin-bottom:10px;border-radius:7px}.jbsm-msg.ok{background:#eef7ee}.jbsm-msg.err{background:#fdeeee}
.jbsm-login{min-height:55vh;display:flex;align-items:center;justify-content:center}.jbsm-login-card{width:min(400px,95%)}.jbsm-login-card h2{text-align:center}.jbsm-login-card form{display:flex;flex-direction:column;gap:12px}.jbsm-login-card label{display:flex;flex-direction:column;gap:5px;font-weight:700}.jbsm-login-card input{padding:10px;border:1px solid #aaa;border-radius:7px}
.jbsm-log-form{display:grid;grid-template-columns:160px 120px 1fr;gap:10px;align-items:end;margin-bottom:15px}.jbsm-log-form label{display:flex;flex-direction:column;gap:5px;font-weight:700}.jbsm-log-form input,.jbsm-log-form select,.jbsm-log-form textarea{padding:8px;border:1px solid #aaa;border-radius:7px}.jbsm-log-form button{grid-column:1/-1;justify-self:start}
@media(max-width:700px){.jbsm-log-form{grid-template-columns:1fr 1fr}.jbsm-log-form .desc{grid-column:1/-1}.jbsm-selectors label{width:100%}.jbsm-selectors select{width:100%;margin:5px 0 0}}

.jbsm-student-photo{width:46px;height:46px;object-fit:cover;border-radius:50%}.jbsm-private-position{width:55px}.jbsm-private-notes{min-width:220px;width:100%;box-sizing:border-box}


/* v0.3.6 - compact desktop gradebook: fit all 22 grade columns on screen */
.jbsm-table-wrap{
    width:100%;
    max-width:100%;
    box-sizing:border-box;
}

.jbsm-grade{
    width:100% !important;
    min-width:0 !important;
    table-layout:fixed;
    font-size:12px;
}

.jbsm-grade th,
.jbsm-grade td{
    padding:2px 1px !important;
    box-sizing:border-box;
    overflow:hidden;
}

.jbsm-grade th:first-child,
.jbsm-grade td.student{
    width:138px !important;
    min-width:138px !important;
    max-width:138px !important;
    text-align:left;
    padding-left:5px !important;
    white-space:normal;
    line-height:1.25;
}

.jbsm-grade th:nth-child(2),
.jbsm-grade td:nth-child(2){
    width:42px !important;
    min-width:42px !important;
    max-width:42px !important;
}

.jbsm-grade th:not(:first-child):not(:nth-child(2)),
.jbsm-grade td:not(:first-child):not(:nth-child(2)){
    width:auto;
}

.jbsm-grade-input{
    width:27px !important;
    min-width:27px !important;
    max-width:27px !important;
    height:29px;
    padding:2px 0 !important;
    font-size:11px;
    text-align:center;
    border-radius:5px;
    box-sizing:border-box;
}

.jbsm-label{
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    height:24px;
    padding:1px !important;
    box-sizing:border-box;
    font-size:9px;
}

.jbsm-grade .sep{
    border-left-width:3px !important;
}

@media (min-width: 1050px){
    .jbsm-table-wrap{
        overflow-x:hidden;
    }
}

@media (max-width:1049px){
    .jbsm-grade{
        min-width:1080px !important;
    }
    .jbsm-table-wrap{
        overflow-x:auto;
    }
}


/* v0.3.7 - read-only student card */
.jbsm-card-button{
    padding:6px 10px;
    border:1px solid #999;
    border-radius:7px;
    background:#fff;
    cursor:pointer;
    font-weight:700;
    white-space:nowrap;
}
.jbsm-card-button:hover{background:#f3f3f3}

.jbsm-modal{
    display:none;
    position:fixed;
    inset:0;
    z-index:999999;
}
.jbsm-modal.open{display:block}
.jbsm-modal-backdrop{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.48);
}
.jbsm-modal-card{
    position:relative;
    width:min(760px,calc(100% - 24px));
    max-height:calc(100vh - 30px);
    overflow:auto;
    margin:15px auto;
    background:#fff;
    border-radius:14px;
    box-shadow:0 18px 60px rgba(0,0,0,.25);
    padding:18px;
    box-sizing:border-box;
}
.jbsm-modal-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid #ddd;
    padding-bottom:10px;
    margin-bottom:15px;
}
.jbsm-modal-head h3{margin:0}
.jbsm-card-close{
    width:34px;
    height:34px;
    border:1px solid #aaa;
    background:#fff;
    border-radius:50%;
    cursor:pointer;
    font-size:23px;
    line-height:28px;
}
.jbsm-card-top{
    display:flex;
    gap:18px;
    align-items:flex-start;
}
.jbsm-card-photo{
    width:100px;
    height:100px;
    object-fit:cover;
    border-radius:12px;
    border:1px solid #ddd;
    flex:0 0 auto;
}
.jbsm-card-photo-empty{
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f1f1f1;
    font-size:28px;
    color:#777;
}
.jbsm-card-main h2{margin:0 0 10px}
.jbsm-card-main>div{margin:4px 0}
.jbsm-card-notes{
    margin-top:16px;
    padding:12px;
    background:#f7f7f7;
    border:1px solid #ddd;
    border-radius:9px;
}
.jbsm-card-notes>div{margin-top:6px;white-space:normal}
.jbsm-card-term{
    margin-top:18px;
}
.jbsm-card-term h4{
    margin:0 0 8px;
    padding-bottom:6px;
    border-bottom:2px solid #444;
}
.jbsm-card-grades{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:7px;
}
.jbsm-card-grade{
    border:1px solid #ddd;
    border-radius:8px;
    padding:8px;
    min-height:48px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}
.jbsm-card-grade span{
    font-size:11px;
    color:#666;
    line-height:1.2;
    word-break:break-word;
}
.jbsm-card-grade b{
    margin-top:5px;
    font-size:19px;
}
.jbsm-card-final{
    border-width:2px;
}
body.jbsm-modal-open{overflow:hidden}

@media(max-width:600px){
    .jbsm-modal-card{
        width:calc(100% - 12px);
        margin:6px auto;
        max-height:calc(100vh - 12px);
        padding:14px;
    }
    .jbsm-card-top{gap:12px}
    .jbsm-card-photo{width:78px;height:78px}
    .jbsm-card-main h2{font-size:20px}
    .jbsm-card-grades{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* v0.3.8 - personal color coding per teacher / subject / grade */
.jbsm-grade-box{position:relative;width:29px;margin:0 auto}
.jbsm-color-button{
    position:absolute;right:-1px;top:-2px;width:10px;height:10px;min-width:10px;
    padding:0;margin:0;border:1px solid #777;border-radius:50%;background:#fff;
    cursor:pointer;z-index:2
}
.jbsm-color-palette{
    display:none;position:fixed;z-index:1000001;padding:7px;gap:6px;background:#fff;
    border:1px solid #aaa;border-radius:9px;box-shadow:0 5px 18px rgba(0,0,0,.25)
}
.jbsm-color-palette.open{display:flex}
.jbsm-color-choice{
    width:23px;height:23px;min-width:23px;padding:0;border:1px solid #777;
    border-radius:50%;background:#fff;cursor:pointer;font-weight:700;line-height:20px
}
.jbsm-grade-color-red{background:#e10600 !important;color:#fff !important}
.jbsm-grade-color-pink{background:#f6b6c8 !important;color:#222 !important}
.jbsm-grade-color-orange{background:#f39c35 !important;color:#222 !important}
.jbsm-grade-color-yellow{background:#f5df55 !important;color:#222 !important}
.jbsm-grade-color-green{background:#71c779 !important;color:#172317 !important}
.jbsm-grade-color-blue{background:#438bd1 !important;color:#fff !important}
.jbsm-grade-color-purple{background:#8d62bd !important;color:#fff !important}
.jbsm-card-grade.jbsm-grade-color-red span,
.jbsm-card-grade.jbsm-grade-color-blue span,
.jbsm-card-grade.jbsm-grade-color-purple span{color:#fff !important}

.jbsm-export-excel{align-self:end;padding:9px 13px;border:1px solid #777;border-radius:7px;background:#fff;cursor:pointer;font-weight:700}.jbsm-export-excel:hover{background:#f3f3f3}

/* v0.4.0 - Written exam and overall final grade */
.jbsm-grade .sep-final{border-left:3px solid #444 !important}
.jbsm-card-final-eval{grid-template-columns:repeat(2,minmax(0,160px));justify-content:start}
@media (min-width:1050px){
    .jbsm-grade th:first-child,
    .jbsm-grade td.student{
        width:120px !important;
        min-width:120px !important;
        max-width:120px !important;
    }
    .jbsm-grade th:nth-child(2),
    .jbsm-grade td:nth-child(2){
        width:36px !important;
        min-width:36px !important;
        max-width:36px !important;
    }
    .jbsm-grade-input{width:25px !important;min-width:25px !important;max-width:25px !important}
    .jbsm-grade-box{width:27px}
}

/* v0.4.1 password recovery */
.jbsm-forgot-password{
    margin-top:12px;
    text-align:center;
}
.jbsm-forgot-password a{
    text-decoration:none;
    font-weight:600;
}
.jbsm-forgot-password a:hover{
    text-decoration:underline;
}

.jbsm-head-actions{display:flex;gap:8px}.jbsm-head-actions button{padding:9px 12px;border:1px solid #999;border-radius:8px;background:#fff;font-weight:700;cursor:pointer}
.jbsm-password-card{width:min(430px,calc(100% - 24px))}.jbsm-password-form{display:grid;gap:12px}.jbsm-password-form label{display:grid;gap:5px;font-weight:700}.jbsm-password-form input{padding:10px;border:1px solid #aaa;border-radius:7px}.jbsm-password-form button{padding:10px;border-radius:8px;background:#222;color:#fff;font-weight:700}

.jbsm-head-actions .jbsm-logout-link{display:inline-block;padding:9px 12px;border:1px solid #999;border-radius:8px;background:#fff;font-weight:700;cursor:pointer;text-decoration:none;color:inherit;box-sizing:border-box}
.jbsm-head-actions .jbsm-logout-link:hover{background:#f3f3f3}
