
/* clean institutional interface */
:root{
    --ui-bg:#f3f0e7;
    --ui-page:#f8f6ef;
    --ui-card:#ffffff;
    --ui-card-soft:#f1f5ee;
    --ui-card-warm:#f3eadc;
    --ui-border:#d5dcd1;
    --ui-text:#202020;
    --ui-muted:#667268;
    --ui-green:#d47a1f;
    --ui-green-hover:#e08a2f;
    --ui-red:#8f463d;
    --ui-shadow:0 10px 24px rgba(44,44,44,.08);
    color-scheme:light;
}
html.theme-dark{
    --ui-bg:#262c25;
    --ui-page:#2d342c;
    --ui-card:#374036;
    --ui-card-soft:#414b40;
    --ui-card-warm:#4b4436;
    --ui-border:#647060;
    --ui-text:#f5f2e8;
    --ui-muted:#d0cbbc;
    --ui-green:#e08a2f;
    --ui-green-hover:#f0a14a;
    --ui-red:#e0a19a;
    --ui-shadow:0 10px 24px rgba(0,0,0,.20);
    color-scheme:dark;
}
*{box-sizing:border-box}
html,body{
    width:100%;
    min-width:0;
    margin:0;
    background:var(--ui-bg)!important;
    color:var(--ui-text)!important;
}
body{
    min-height:100vh;
    font-family:Arial, Helvetica, sans-serif!important;
}
.sheet{
    width:100%!important;
    max-width:none!important;
    min-height:100vh!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:var(--ui-page)!important;
    color:var(--ui-text)!important;
    box-shadow:none!important;
}
main{
    width:100%!important;
    max-width:none!important;
    padding:24px clamp(18px,3vw,46px) 36px!important;
    background:var(--ui-page)!important;
}
.site-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    min-height:76px;
    padding:16px clamp(18px,3vw,46px);
    border-bottom:1px solid var(--ui-border);
    background:var(--ui-card);
    color:var(--ui-text);
}
.site-brand{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:270px;
    color:var(--ui-text)!important;
    text-decoration:none!important;
}
.site-brand__mark{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:42px;
    height:42px;
    border-radius:12px;
    background:var(--ui-green);
    color:#fff;
    font-size:22px;
}
html.theme-dark .site-brand__mark{
    color:#202020;
}
.site-brand strong{
    display:block;
    color:var(--ui-text);
    font-size:21px;
    line-height:1.1;
    letter-spacing:-.02em;
}
.site-brand span{
    display:block;
    margin-top:3px;
    color:var(--ui-muted);
    font-size:13px;
}
.site-nav{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:wrap;
    gap:10px;
}
.site-nav a,
.site-theme-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:42px;
    padding:0 15px!important;
    border:1px solid var(--ui-border)!important;
    border-radius:12px!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    font:inherit!important;
    font-weight:700!important;
    text-decoration:none!important;
    box-shadow:none!important;
    cursor:pointer;
}
.site-nav a:hover,
.site-theme-toggle:hover{
    background:var(--ui-card-warm)!important;
    color:var(--ui-text)!important;
    text-decoration:none!important;
}
.site-theme-toggle span:first-child{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:22px;
    height:22px;
    border-radius:50%;
    background:var(--ui-card);
    color:var(--ui-green);
    font-weight:900;
}
.site-nav .logout-link{
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
    color:#fff!important;
}
html.theme-dark .site-nav .logout-link{
    color:#202020!important;
}
.site-nav .logout-link:hover{
    background:var(--ui-green-hover)!important;
    border-color:var(--ui-green-hover)!important;
}
.flash{
    margin:18px clamp(18px,3vw,46px) 0!important;
    border:1px solid var(--ui-border)!important;
    border-left:4px solid var(--ui-green)!important;
    border-radius:14px!important;
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
}
.site-footer{
    display:grid;
    grid-template-columns:1fr 1.3fr;
    gap:18px;
    padding:22px clamp(18px,3vw,46px);
    border-top:1px solid var(--ui-border);
    background:var(--ui-card);
    color:var(--ui-muted);
    font-size:13px;
}
.site-footer strong{
    display:block;
    margin-bottom:4px;
    color:var(--ui-text);
    font-size:15px;
}
.site-footer span{
    display:block;
}
.site-footer div:last-child{
    text-align:right;
}

/* Common blocks */
.panel,.stat,.desk-card,.admin-cover,.admin-stat,.admin-note,.admin-tab-panel,
.service-grid>div,.people-create,.user-card,.list-tools,.class-pill,
.teacher-shell,.teacher-stat,.teacher-panel,.teacher-form-card,.teacher-list-card,
.learner-shell,.learner-stat,.learner-panel,.learner-card,.parent-admin-box,
.login-box,.hero-card{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:var(--ui-shadow)!important;
}
.panel.tinted,.empty,.admin-tabs,.teacher-tabs,.learner-tabs,
.teacher-form-card,.learner-card,.teacher-empty,.learner-empty,.parent-empty,
.badge,.teacher-badge,.teacher-chip,.learner-badge,.learner-item,.parent-child-list a{
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
h1,h2,h3,h4,.site-brand strong,
.admin-cover h1,.teacher-head h1,.learner-head h1,.parent-admin-head h1{
    color:var(--ui-text)!important;
}
p,.muted,.small-muted,.list-count,
.admin-cover p,.admin-stat span,.admin-note span,
.teacher-stat span,.learner-stat span,
.teacher-head p,.teacher-section-head p,
.learner-head p,.learner-section-head p,.parent-admin-head p,
.badge,.teacher-badge,.teacher-chip,.learner-badge{
    color:var(--ui-muted)!important;
}
button,.btn,.btn-small,
.admin-page button,.admin-page .btn,.admin-page .btn-small,
.teacher-admin button,.teacher-admin .btn{
    border:1px solid var(--ui-green)!important;
    border-radius:12px!important;
    background:var(--ui-green)!important;
    color:#fff!important;
    font-weight:700!important;
    box-shadow:none!important;
}
html.theme-dark button,
html.theme-dark .btn,
html.theme-dark .btn-small,
html.theme-dark .admin-page button,
html.theme-dark .admin-page .btn,
html.theme-dark .admin-page .btn-small,
html.theme-dark .teacher-admin button,
html.theme-dark .teacher-admin .btn{
    color:#202020!important;
}
button:hover,.btn:hover,.btn-small:hover,
.admin-page button:hover,.admin-page .btn:hover,.admin-page .btn-small:hover,
.teacher-admin button:hover,.teacher-admin .btn:hover{
    background:var(--ui-green-hover)!important;
    border-color:var(--ui-green-hover)!important;
}
.btn-light,.admin-page .btn-light{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.btn-danger-light,.admin-page .btn-danger-light{
    background:var(--ui-card)!important;
    color:var(--ui-red)!important;
    border-color:var(--ui-border)!important;
}
input,select,textarea,
.teacher-admin input,.teacher-admin select,.teacher-admin textarea{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    border-radius:12px!important;
}
input::placeholder,textarea::placeholder{
    color:var(--ui-muted)!important;
    opacity:.8!important;
}
table{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
th{
    background:var(--ui-card-soft)!important;
    color:var(--ui-muted)!important;
    border-color:var(--ui-border)!important;
}
td{
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
tr:hover td{
    background:var(--ui-card-soft)!important;
}

/* Admin: remove decorative overlaps */
.admin-page{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    color:var(--ui-text)!important;
}
.admin-head{
    display:grid!important;
    grid-template-columns:minmax(0,1.45fr) minmax(280px,.8fr)!important;
    gap:18px!important;
    margin-bottom:18px!important;
}
.admin-cover{
    min-height:0!important;
    padding:28px 30px!important;
    border-radius:18px!important;
    overflow:hidden!important;
}
.admin-cover:before,.admin-cover:after{
    content:none!important;
    display:none!important;
}
.admin-cover h1{
    margin:0 0 12px!important;
    font-size:clamp(30px,3.6vw,46px)!important;
    line-height:1.08!important;
    letter-spacing:-.025em!important;
}
.admin-cover .stamp{
    display:inline-flex!important;
    margin-top:16px!important;
    padding:9px 13px!important;
    border:1px solid var(--ui-border)!important;
    border-radius:999px!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-muted)!important;
}
.admin-today{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:14px!important;
}
.admin-stat,.admin-note{
    border-radius:16px!important;
    min-width:0!important;
}
.admin-stat strong,.admin-note strong{
    color:var(--ui-green)!important;
}
.admin-tabs{
    position:static!important;
    display:flex!important;
    gap:10px!important;
    padding:10px!important;
    margin-bottom:18px!important;
    border:1px solid var(--ui-border)!important;
    border-radius:18px!important;
    box-shadow:none!important;
}
.admin-tabs button,.admin-tabs a{
    border:1px solid transparent!important;
    border-radius:12px!important;
    background:transparent!important;
    color:var(--ui-muted)!important;
    box-shadow:none!important;
}
.admin-tabs button.is-active,.admin-tabs button:hover,
.admin-tabs a.active,.admin-tabs a:hover{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.desk-card,.admin-tab-panel{
    border-radius:18px!important;
    padding:22px!important;
    overflow:hidden!important;
}
.service-grid{
    grid-template-columns:minmax(260px,.45fr) minmax(0,1fr)!important;
    gap:18px!important;
}
.service-grid>div{
    min-width:0!important;
    overflow:hidden!important;
}
.table-scroll,.teacher-table,.learner-table,.teacher-table-wrap{
    max-width:100%!important;
    overflow:auto!important;
}
.admin-actions,.inline-form{
    min-width:0!important;
}

/* Teacher/student/parent: calmer cards */
.teacher-shell,.learner-shell,.parent-admin-box{
    width:100%!important;
    max-width:none!important;
    border-radius:18px!important;
    background:var(--ui-card)!important;
}
.teacher-head,.learner-head,.parent-admin-head,
.teacher-section-head,.learner-section-head{
    border-color:var(--ui-border)!important;
}
.teacher-tabs,.learner-tabs{
    position:static!important;
    border:1px solid var(--ui-border)!important;
    border-radius:18px!important;
    box-shadow:none!important;
}
.teacher-tabs a,.learner-tabs a{
    border:1px solid transparent!important;
    background:transparent!important;
    color:var(--ui-muted)!important;
}
.teacher-tabs a.active,.teacher-tabs a:hover,
.learner-tabs a.active,.learner-tabs a:hover{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.teacher-panel,.learner-panel{
    border-radius:18px!important;
}
.teacher-form-card,.teacher-list-card,.learner-card{
    border-radius:16px!important;
}
.teacher-workspace{
    grid-template-columns:minmax(300px,360px) minmax(0,1fr)!important;
}
.learner-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
}

/* full width */
.admin-page,.teacher-admin,.learner-admin{
    width:100%!important;
    max-width:none!important;
}

/* dark readable fixes */
html.theme-dark .mark.m5,
html.theme-dark .teacher-mark.m5,
html.theme-dark .learner-mark.m5{color:#e2e2e2!important}
html.theme-dark .mark.m4,
html.theme-dark .teacher-mark.m4,
html.theme-dark .learner-mark.m4{color:#dfc284!important}
html.theme-dark .mark.m3,
html.theme-dark .teacher-mark.m3,
html.theme-dark .learner-mark.m3{color:#e5b36b!important}
html.theme-dark .mark.m2,
html.theme-dark .teacher-mark.m2,
html.theme-dark .learner-mark.m2{color:#e0a19a!important}

@media(max-width:1100px){
    .admin-head,.teacher-workspace{
        grid-template-columns:1fr!important;
    }
    .service-grid{
        grid-template-columns:1fr!important;
    }
}
@media(max-width:820px){
    main{
        padding:16px 12px 28px!important;
    }
    .site-header{
        display:block;
        padding:14px!important;
    }
    .site-brand{
        min-width:0;
        margin-bottom:12px;
    }
    .site-nav{
        justify-content:flex-start;
    }
    .site-nav a,.site-theme-toggle{
        flex:1 1 auto;
    }
    .site-footer{
        grid-template-columns:1fr;
        padding:18px 14px;
    }
    .site-footer div:last-child{
        text-align:left;
    }
    .flash{
        margin-left:14px!important;
        margin-right:14px!important;
    }
    .admin-cover{
        padding:22px!important;
    }
    .admin-today,.teacher-stats,.learner-stats,.learner-grid{
        grid-template-columns:1fr!important;
    }
}


/* no emoji interface marks */
.site-brand__mark{
    font-family:Arial, Helvetica, sans-serif!important;
    font-size:22px!important;
    font-weight:800!important;
    letter-spacing:0!important;
}
.site-theme-toggle [data-theme-icon]{
    font-family:Arial, Helvetica, sans-serif!important;
    font-size:13px!important;
    font-weight:800!important;
}


/* restored theme button symbols */
.site-theme-toggle [data-theme-icon]{
    font-family:Arial, Helvetica, sans-serif!important;
    font-size:15px!important;
    font-weight:800!important;
}




/* balanced clean interface: not full-screen, lighter and more stable */
:root{
    --ui-bg:#eee9dd;
    --ui-page:#f7f4ec;
    --ui-card:#ffffff;
    --ui-card-soft:#f1f4ee;
    --ui-card-warm:#f4eadb;
    --ui-border:#d4d9ce;
    --ui-text:#202020;
    --ui-muted:#667166;
    --ui-green:#e08a2f;
    --ui-green-hover:#e08a2f;
    --ui-red:#8b463f;
    --ui-shadow:0 6px 18px rgba(64,78,58,.08);
    color-scheme:light;
}
html.theme-dark{
    --ui-bg:#2a3029;
    --ui-page:#31382f;
    --ui-card:#3a4338;
    --ui-card-soft:#434d40;
    --ui-card-warm:#4b4436;
    --ui-border:#667160;
    --ui-text:#f5f1e6;
    --ui-muted:#d4cdbc;
    --ui-green:#e08a2f;
    --ui-green-hover:#f0a14a;
    --ui-red:#e0a099;
    --ui-shadow:none;
    color-scheme:dark;
}
html,
body{
    background:var(--ui-bg)!important;
    color:var(--ui-text)!important;
}
.sheet{
    width:calc(100% - 32px)!important;
    max-width:1360px!important;
    min-height:calc(100vh - 32px)!important;
    margin:16px auto!important;
    border:1px solid var(--ui-border)!important;
    border-radius:18px!important;
    overflow:hidden!important;
    background:var(--ui-page)!important;
    color:var(--ui-text)!important;
    box-shadow:0 12px 32px rgba(58,72,53,.10)!important;
}
main{
    width:100%!important;
    max-width:none!important;
    padding:22px 26px 32px!important;
    background:var(--ui-page)!important;
}
.site-header{
    min-height:72px!important;
    padding:14px 26px!important;
    background:var(--ui-card)!important;
    border-bottom:1px solid var(--ui-border)!important;
    box-shadow:none!important;
}
.site-footer{
    padding:18px 26px!important;
    background:var(--ui-card)!important;
    border-top:1px solid var(--ui-border)!important;
}
.site-brand__mark{
    width:38px!important;
    height:38px!important;
    border-radius:10px!important;
    background:var(--ui-green)!important;
    color:#fff!important;
}
html.theme-dark .site-brand__mark{
    color:#202020!important;
}
.site-brand strong{
    font-size:20px!important;
}
.site-brand span,
.site-footer span,
.muted,
.small-muted,
p{
    color:var(--ui-muted)!important;
}
.site-nav{
    gap:8px!important;
}
.site-nav a{
    min-height:40px!important;
    border-radius:11px!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:none!important;
}
.site-nav .logout-link{
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
    color:#fff!important;
}
html.theme-dark .site-nav .logout-link{
    color:#202020!important;
}

/* normal compact theme switch, without labels and without layout glitches */
.site-nav .theme-switch{
    position:relative!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:72px!important;
    min-width:72px!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    border:1px solid var(--ui-border)!important;
    border-radius:999px!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    box-shadow:none!important;
    overflow:hidden!important;
}
.site-nav .theme-switch__track{
    position:relative!important;
    display:block!important;
    width:60px!important;
    height:30px!important;
    border-radius:999px!important;
    background:var(--ui-card)!important;
    border:1px solid var(--ui-border)!important;
}
.site-nav .theme-switch__icon{
    position:absolute!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:24px!important;
    height:24px!important;
    font-size:14px!important;
    line-height:1!important;
    color:var(--ui-muted)!important;
    z-index:1!important;
}
.site-nav .theme-switch__sun{
    left:4px!important;
}
.site-nav .theme-switch__moon{
    right:4px!important;
}
.site-nav .theme-switch__thumb{
    position:absolute!important;
    left:3px!important;
    top:3px!important;
    display:block!important;
    width:22px!important;
    height:22px!important;
    border-radius:50%!important;
    background:var(--ui-green)!important;
    z-index:2!important;
    transform:none!important;
    transition:transform .18s ease!important;
}
html.theme-dark .site-nav .theme-switch__thumb{
    transform:translateX(30px)!important;
    background:var(--ui-green)!important;
}
html.theme-dark .site-nav .theme-switch{
    background:var(--ui-card-soft)!important;
}
html.theme-dark .site-nav .theme-switch__track{
    background:var(--ui-card)!important;
}

/* reduce "generated" feel: fewer effects and stable cards */
*{
    transition:none!important;
}
.panel,.stat,.desk-card,.admin-cover,.admin-stat,.admin-note,.admin-tab-panel,
.service-grid>div,.people-create,.user-card,.list-tools,.class-pill,
.teacher-shell,.teacher-stat,.teacher-panel,.teacher-form-card,.teacher-list-card,
.learner-shell,.learner-stat,.learner-panel,.learner-card,.parent-admin-box,
.login-box,.hero-card{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:var(--ui-shadow)!important;
}
.panel.tinted,.empty,.admin-tabs,.teacher-tabs,.learner-tabs,
.teacher-form-card,.learner-card,.teacher-empty,.learner-empty,.parent-empty,
.badge,.teacher-badge,.teacher-chip,.learner-badge,.learner-item,.parent-child-list a{
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.admin-cover,
.teacher-shell,
.learner-shell,
.parent-admin-box,
.desk-card,
.teacher-panel,
.learner-panel{
    border-radius:16px!important;
}
.admin-cover:before,
.admin-cover:after{
    content:none!important;
    display:none!important;
}
.admin-head{
    grid-template-columns:minmax(0,1.35fr) minmax(260px,.85fr)!important;
    gap:16px!important;
}
.admin-cover{
    min-height:0!important;
    padding:24px 26px!important;
}
.admin-cover h1{
    font-size:clamp(30px,3.4vw,44px)!important;
    line-height:1.08!important;
    letter-spacing:-.02em!important;
}
.admin-cover p{
    max-width:780px!important;
    line-height:1.55!important;
}
.admin-today{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:12px!important;
}
.admin-tabs,
.teacher-tabs,
.learner-tabs{
    position:static!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    border-radius:14px!important;
    padding:8px!important;
    gap:8px!important;
}
.admin-tabs button,
.admin-tabs a,
.teacher-tabs a,
.learner-tabs a{
    border-radius:10px!important;
    border:1px solid transparent!important;
    background:transparent!important;
    color:var(--ui-muted)!important;
    box-shadow:none!important;
}
.admin-tabs button.is-active,
.admin-tabs button:hover,
.admin-tabs a.active,
.admin-tabs a:hover,
.teacher-tabs a.active,
.teacher-tabs a:hover,
.learner-tabs a.active,
.learner-tabs a:hover{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
button,.btn,.btn-small,
.admin-page button,.admin-page .btn,.admin-page .btn-small,
.teacher-admin button,.teacher-admin .btn{
    border-radius:10px!important;
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
    color:#fff!important;
    box-shadow:none!important;
}
html.theme-dark button,
html.theme-dark .btn,
html.theme-dark .btn-small,
html.theme-dark .admin-page button,
html.theme-dark .admin-page .btn,
html.theme-dark .admin-page .btn-small,
html.theme-dark .teacher-admin button,
html.theme-dark .teacher-admin .btn{
    color:#202020!important;
}
.btn-light,.admin-page .btn-light{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.btn-danger-light,.admin-page .btn-danger-light{
    background:var(--ui-card)!important;
    color:var(--ui-red)!important;
    border-color:var(--ui-border)!important;
}
input,select,textarea,
.teacher-admin input,.teacher-admin select,.teacher-admin textarea{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    border-radius:10px!important;
}
table{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    table-layout:auto!important;
}
th{
    background:var(--ui-card-soft)!important;
    color:var(--ui-muted)!important;
}
td{
    color:var(--ui-text)!important;
}
tr:hover td{
    background:var(--ui-card-soft)!important;
}

/* prevent hidden/overlapped content */
.desk-card,
.admin-tab-panel,
.service-grid>div,
.teacher-panel,
.learner-panel,
.teacher-list-card,
.learner-card,
.parent-admin-box{
    min-width:0!important;
    overflow:hidden!important;
}
.table-scroll,
.teacher-table,
.learner-table,
.teacher-table-wrap{
    width:100%!important;
    max-width:100%!important;
    overflow:auto!important;
}
.teacher-table table,
.learner-table table,
.teacher-table-wrap table{
    min-width:720px!important;
}
.admin-actions,
.inline-form,
.subject-teacher-form{
    min-width:0!important;
}
.service-grid{
    grid-template-columns:minmax(240px,.42fr) minmax(0,1fr)!important;
    gap:16px!important;
}
.teacher-workspace{
    grid-template-columns:minmax(290px,360px) minmax(0,1fr)!important;
    gap:16px!important;
}
.learner-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
@media(max-width:1100px){
    .admin-head,
    .service-grid,
    .teacher-workspace{
        grid-template-columns:1fr!important;
    }
}
@media(max-width:820px){
    .sheet{
        width:100%!important;
        min-height:100vh!important;
        margin:0!important;
        border-radius:0!important;
        border-left:0!important;
        border-right:0!important;
    }
    main{
        padding:16px 12px 28px!important;
    }
    .site-header{
        display:block!important;
        padding:14px!important;
    }
    .site-brand{
        min-width:0!important;
        margin-bottom:12px!important;
    }
    .site-nav{
        justify-content:flex-start!important;
    }
    .site-footer{
        grid-template-columns:1fr!important;
        padding:18px 14px!important;
    }
    .site-footer div:last-child{
        text-align:left!important;
    }
    .admin-today,
    .teacher-stats,
    .learner-stats,
    .learner-grid{
        grid-template-columns:1fr!important;
    }
}


/* final readability and switcher correction */
html.theme-dark{
    --ui-bg:#2b3129;
    --ui-page:#31382f;
    --ui-card:#3b463b;
    --ui-card-soft:#465242;
    --ui-card-warm:#544a38;
    --ui-border:#70806a;
    --ui-text:#f7f3e8;
    --ui-muted:#ddd6c7;
    --ui-green:#e08a2f;
    --ui-green-hover:#f0a14a;
    --ui-red:#e6aaa2;
    color-scheme:dark;
}
html.theme-dark body,
html.theme-dark .sheet,
html.theme-dark main{
    background:var(--ui-page)!important;
    color:var(--ui-text)!important;
}
html.theme-dark .site-header,
html.theme-dark .site-footer,
html.theme-dark .panel,
html.theme-dark .stat,
html.theme-dark .desk-card,
html.theme-dark .admin-cover,
html.theme-dark .admin-stat,
html.theme-dark .admin-note,
html.theme-dark .admin-tab-panel,
html.theme-dark .service-grid > div,
html.theme-dark .people-create,
html.theme-dark .user-card,
html.theme-dark .list-tools,
html.theme-dark .class-pill,
html.theme-dark .teacher-shell,
html.theme-dark .teacher-stat,
html.theme-dark .teacher-panel,
html.theme-dark .teacher-form-card,
html.theme-dark .teacher-list-card,
html.theme-dark .learner-shell,
html.theme-dark .learner-stat,
html.theme-dark .learner-panel,
html.theme-dark .learner-card,
html.theme-dark .parent-admin-box,
html.theme-dark .flash,
html.theme-dark table,
html.theme-dark td{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark .panel.tinted,
html.theme-dark .empty,
html.theme-dark .admin-tabs,
html.theme-dark .teacher-tabs,
html.theme-dark .learner-tabs,
html.theme-dark .teacher-empty,
html.theme-dark .learner-empty,
html.theme-dark .parent-empty,
html.theme-dark .badge,
html.theme-dark .teacher-badge,
html.theme-dark .teacher-chip,
html.theme-dark .learner-badge,
html.theme-dark .learner-item,
html.theme-dark .parent-child-list a,
html.theme-dark th{
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark h4,
html.theme-dark .site-brand strong,
html.theme-dark .admin-cover h1,
html.theme-dark .teacher-head h1,
html.theme-dark .learner-head h1,
html.theme-dark .parent-admin-head h1{
    color:var(--ui-text)!important;
}
html.theme-dark p,
html.theme-dark .muted,
html.theme-dark .small-muted,
html.theme-dark .list-count,
html.theme-dark .site-brand span,
html.theme-dark .site-footer span,
html.theme-dark .admin-cover p,
html.theme-dark .admin-stat span,
html.theme-dark .admin-note span,
html.theme-dark .teacher-stat span,
html.theme-dark .learner-stat span,
html.theme-dark .teacher-head p,
html.theme-dark .teacher-section-head p,
html.theme-dark .learner-head p,
html.theme-dark .learner-section-head p,
html.theme-dark .parent-admin-head p,
html.theme-dark .badge,
html.theme-dark .teacher-badge,
html.theme-dark .teacher-chip,
html.theme-dark .learner-badge{
    color:var(--ui-muted)!important;
}

/* Вкладки в тёмной теме должны быть читаемыми */
html.theme-dark .admin-tabs button,
html.theme-dark .admin-tabs a,
html.theme-dark .teacher-tabs a,
html.theme-dark .learner-tabs a{
    background:transparent!important;
    color:var(--ui-muted)!important;
    border-color:transparent!important;
    opacity:1!important;
}
html.theme-dark .admin-tabs button.is-active,
html.theme-dark .admin-tabs button:hover,
html.theme-dark .admin-tabs a.active,
html.theme-dark .admin-tabs a:hover,
html.theme-dark .teacher-tabs a.active,
html.theme-dark .teacher-tabs a:hover,
html.theme-dark .learner-tabs a.active,
html.theme-dark .learner-tabs a:hover{
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
    color:#202020!important;
    opacity:1!important;
}
html.theme-dark .admin-tabs button *,
html.theme-dark .teacher-tabs a *,
html.theme-dark .learner-tabs a *{
    color:inherit!important;
}

html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea{
    background:#323b32!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder{
    color:#d2caba!important;
}
html.theme-dark button,
html.theme-dark .btn,
html.theme-dark .btn-small,
html.theme-dark .admin-page button,
html.theme-dark .admin-page .btn,
html.theme-dark .admin-page .btn-small,
html.theme-dark .teacher-admin button,
html.theme-dark .teacher-admin .btn{
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
    color:#202020!important;
}
html.theme-dark button:hover,
html.theme-dark .btn:hover,
html.theme-dark .btn-small:hover{
    background:var(--ui-green-hover)!important;
    border-color:var(--ui-green-hover)!important;
    color:#202020!important;
}

/* Переключатель темы: без подписей, как исходный аккуратный ползунок */
.site-nav .theme-switch{
    position:relative!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:76px!important;
    min-width:76px!important;
    height:42px!important;
    min-height:42px!important;
    padding:0!important;
    border:1px solid var(--ui-border)!important;
    border-radius:999px!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    overflow:hidden!important;
    box-shadow:none!important;
}
.site-nav .theme-switch__track{
    position:relative!important;
    display:block!important;
    width:64px!important;
    height:32px!important;
    border-radius:999px!important;
    background:var(--ui-card)!important;
    border:1px solid var(--ui-border)!important;
}
.site-nav .theme-switch__icon{
    position:absolute!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:24px!important;
    height:24px!important;
    font-size:14px!important;
    line-height:1!important;
    color:var(--ui-muted)!important;
    z-index:1!important;
    pointer-events:none!important;
}
.site-nav .theme-switch__sun{
    left:5px!important;
}
.site-nav .theme-switch__moon{
    right:5px!important;
}
.site-nav .theme-switch__thumb{
    position:absolute!important;
    left:4px!important;
    top:4px!important;
    display:block!important;
    width:22px!important;
    height:22px!important;
    border-radius:50%!important;
    background:var(--ui-green)!important;
    z-index:2!important;
    transform:none!important;
}
html.theme-dark .site-nav .theme-switch{
    background:var(--ui-card-soft)!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark .site-nav .theme-switch__track{
    background:var(--ui-card)!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark .site-nav .theme-switch__thumb{
    transform:translateX(32px)!important;
    background:var(--ui-green)!important;
}

/* Новый знак в шапке */
.site-brand__mark{
    width:42px!important;
    height:42px!important;
    border-radius:10px!important;
    font-family:Arial, Helvetica, sans-serif!important;
    font-size:16px!important;
    font-weight:800!important;
    letter-spacing:-.04em!important;
    background:var(--ui-green)!important;
    color:#fff!important;
}
html.theme-dark .site-brand__mark{
    color:#202020!important;
}


/* final header logo image */
.site-brand__mark{
    width:42px!important;
    height:42px!important;
    padding:0!important;
    overflow:hidden!important;
    background:transparent!important;
    border-radius:12px!important;
}
.site-brand__mark img{
    display:block!important;
    width:42px!important;
    height:42px!important;
    object-fit:contain!important;
}
html.theme-dark .site-brand__mark{
    background:transparent!important;
}

/* remove admin intro stamp completely */
.admin-cover .stamp{
    display:none!important;
}


/* final classic institutional corrections */
:root{
    --ui-bg:#e9e5da;
    --ui-page:#f6f3ea;
    --ui-card:#ffffff;
    --ui-card-soft:#eef1ea;
    --ui-card-warm:#eee3d1;
    --ui-border:#cfd6cc;
    --ui-text:#202020;
    --ui-muted:#5e675f;
    --ui-green:#d47a1f;
    --ui-green-hover:#e08a2f;
    --ui-red:#8d453d;
    --ui-shadow:none;
}
html.theme-dark{
    --ui-bg:#2d332d;
    --ui-page:#333a33;
    --ui-card:#3d473d;
    --ui-card-soft:#465146;
    --ui-card-warm:#504938;
    --ui-border:#74806f;
    --ui-text:#f7f1e6;
    --ui-muted:#d9d1c2;
    --ui-green:#e08a2f;
    --ui-green-hover:#f0a14a;
    --ui-red:#e2aaa3;
    --ui-shadow:none;
}
.sheet{
    max-width:1320px!important;
    border-radius:10px!important;
    box-shadow:none!important;
}
.site-header,
.site-footer{
    box-shadow:none!important;
}
.panel,
.stat,
.desk-card,
.admin-cover,
.admin-stat,
.admin-note,
.admin-tab-panel,
.service-grid > div,
.people-create,
.user-card,
.list-tools,
.class-pill,
.teacher-shell,
.teacher-stat,
.teacher-panel,
.teacher-form-card,
.teacher-list-card,
.learner-shell,
.learner-stat,
.learner-panel,
.learner-card,
.parent-admin-box,
.login-box,
.hero-card{
    border-radius:10px!important;
    box-shadow:none!important;
}
.admin-cover,
.desk-card,
.admin-tab-panel,
.teacher-shell,
.learner-shell,
.parent-admin-box{
    padding:20px!important;
}
.admin-cover h1,
.teacher-head h1,
.learner-head h1,
.parent-admin-head h1{
    letter-spacing:0!important;
}
.admin-cover h1{
    font-size:clamp(28px,3vw,40px)!important;
}
.admin-tabs,
.teacher-tabs,
.learner-tabs{
    border-radius:10px!important;
    padding:6px!important;
    gap:6px!important;
}
.admin-tabs button,
.admin-tabs a,
.teacher-tabs a,
.learner-tabs a,
.site-nav a,
.btn,
button,
.btn-small{
    border-radius:8px!important;
}
.admin-stat strong,
.admin-note strong,
.teacher-stat strong,
.learner-stat strong{
    color:var(--ui-text)!important;
}

/* readable form controls, including opened native select menus */
input,
select,
textarea,
option,
optgroup{
    font:inherit!important;
}
select{
    color:var(--ui-text)!important;
    background:var(--ui-card)!important;
    border:1px solid var(--ui-border)!important;
}
select option,
select optgroup{
    color:#202020!important;
    background:#ffffff!important;
}
html.theme-dark select{
    color:var(--ui-text)!important;
    background:#374136!important;
    border-color:var(--ui-border)!important;
}
html.theme-dark select option,
html.theme-dark select optgroup{
    color:#202020!important;
    background:#ffffff!important;
}
html.theme-dark select:focus,
html.theme-dark input:focus,
html.theme-dark textarea:focus{
    outline:2px solid var(--ui-green)!important;
    outline-offset:1px!important;
}

/* request cards and inline actions should not overlap */
.request-card,
.user-card,
.list-card,
.admin-row,
.subject-row{
    min-width:0!important;
}
.inline-form,
.admin-actions,
.subject-teacher-form,
.request-actions,
.row-actions{
    display:flex!important;
    align-items:center!important;
    flex-wrap:wrap!important;
    gap:8px!important;
}
.inline-form select,
.inline-form input,
.subject-teacher-form select,
.request-actions select{
    min-width:170px!important;
    width:auto!important;
    max-width:100%!important;
}
.inline-form button,
.request-actions button,
.subject-teacher-form button{
    white-space:nowrap!important;
}

/* dark mode: make every text layer readable */
html.theme-dark,
html.theme-dark body,
html.theme-dark .sheet,
html.theme-dark main,
html.theme-dark .site-header,
html.theme-dark .site-footer,
html.theme-dark .panel,
html.theme-dark .stat,
html.theme-dark .desk-card,
html.theme-dark .admin-cover,
html.theme-dark .admin-stat,
html.theme-dark .admin-note,
html.theme-dark .admin-tab-panel,
html.theme-dark .service-grid > div,
html.theme-dark .people-create,
html.theme-dark .user-card,
html.theme-dark .list-tools,
html.theme-dark .class-pill,
html.theme-dark .teacher-shell,
html.theme-dark .teacher-stat,
html.theme-dark .teacher-panel,
html.theme-dark .teacher-form-card,
html.theme-dark .teacher-list-card,
html.theme-dark .learner-shell,
html.theme-dark .learner-stat,
html.theme-dark .learner-panel,
html.theme-dark .learner-card,
html.theme-dark .parent-admin-box,
html.theme-dark .flash,
html.theme-dark table,
html.theme-dark th,
html.theme-dark td,
html.theme-dark li,
html.theme-dark label{
    color:var(--ui-text)!important;
}
html.theme-dark .muted,
html.theme-dark .small-muted,
html.theme-dark .list-count,
html.theme-dark .site-brand span,
html.theme-dark .site-footer span,
html.theme-dark p,
html.theme-dark .badge,
html.theme-dark .teacher-badge,
html.theme-dark .teacher-chip,
html.theme-dark .learner-badge{
    color:var(--ui-muted)!important;
}
html.theme-dark .admin-tabs button,
html.theme-dark .admin-tabs a,
html.theme-dark .teacher-tabs a,
html.theme-dark .learner-tabs a{
    color:var(--ui-text)!important;
    background:transparent!important;
    opacity:1!important;
}
html.theme-dark .admin-tabs button.is-active,
html.theme-dark .admin-tabs button:hover,
html.theme-dark .admin-tabs a.active,
html.theme-dark .admin-tabs a:hover,
html.theme-dark .teacher-tabs a.active,
html.theme-dark .teacher-tabs a:hover,
html.theme-dark .learner-tabs a.active,
html.theme-dark .learner-tabs a:hover{
    color:#202020!important;
    background:var(--ui-green)!important;
    border-color:var(--ui-green)!important;
}

/* keep original theme switch visible but restrained */
.site-nav .theme-toggle.theme-switch{
    width:auto!important;
    min-width:0!important;
    height:auto!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
}
.site-nav .theme-switch__track{
    box-shadow:none!important;
}
@media(max-width:820px){
    .sheet{
        border-radius:0!important;
        width:100%!important;
        margin:0!important;
    }
    .inline-form,
    .admin-actions,
    .subject-teacher-form,
    .request-actions,
    .row-actions{
        display:grid!important;
        grid-template-columns:1fr!important;
    }
    .inline-form select,
    .inline-form input,
    .subject-teacher-form select,
    .request-actions select,
    .inline-form button,
    .request-actions button,
    .subject-teacher-form button{
        width:100%!important;
    }
}


/* real journal tab */
.journal-real{
    display:none;
}
.journal-real.is-active{
    display:block;
}
.journal-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:16px;
    padding-bottom:14px;
    margin-bottom:14px;
    border-bottom:1px solid var(--ui-border, var(--line));
}
.journal-head h2{
    margin:0 0 6px!important;
}
.journal-period{
    min-width:120px;
    padding:10px 12px;
    border:1px solid var(--ui-border, var(--line));
    border-radius:10px;
    background:var(--ui-card-soft, #f7f7f1);
    text-align:center;
}
.journal-period span{
    display:block;
    color:var(--ui-muted, var(--muted));
    font-size:12px;
}
.journal-period b{
    display:block;
    margin-top:3px;
}
.journal-stats{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:10px;
    margin-bottom:16px;
}
.journal-stats div{
    min-width:0;
    padding:12px;
    border:1px solid var(--ui-border, var(--line));
    border-radius:10px;
    background:var(--ui-card, #fff);
}
.journal-stats span{
    display:block;
    color:var(--ui-muted, var(--muted));
    font-size:12px;
}
.journal-stats b{
    display:block;
    margin-top:4px;
    font-size:24px;
    line-height:1;
}
.journal-forms{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
    margin-bottom:18px;
}
.journal-forms details{
    min-width:0;
    border:1px solid var(--ui-border, var(--line));
    border-radius:10px;
    background:var(--ui-card-soft, #f7f7f1);
    overflow:hidden;
}
.journal-forms summary{
    cursor:pointer;
    padding:12px 14px;
    font-weight:700;
    color:var(--ui-text, var(--ink));
}
.journal-form{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    padding:0 14px 14px;
}
.journal-form label{
    min-width:0;
}
.journal-form .wide{
    grid-column:1 / -1;
}
.journal-form button{
    justify-self:start;
}
.journal-section{
    margin-top:16px;
    padding-top:16px;
    border-top:1px solid var(--ui-border, var(--line));
}
.journal-two-columns{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px;
}
.journal-table-wrap{
    width:100%;
    max-width:100%;
    overflow:auto;
    border:1px solid var(--ui-border, var(--line));
    border-radius:10px;
    background:var(--ui-card, #fff);
}
.journal-table{
    width:100%;
    min-width:880px;
    border-collapse:collapse;
}
.journal-table.compact{
    min-width:720px;
}
.journal-table th,
.journal-table td{
    vertical-align:top;
    padding:10px;
}
.journal-table th{
    white-space:nowrap;
}
.journal-average{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:40px;
    min-height:32px;
    padding:0 8px;
    border:1px solid var(--ui-border, var(--line));
    border-radius:8px;
    background:var(--ui-card-soft, #f7f7f1);
    font-weight:700;
}
.journal-actions-cell{
    min-width:190px;
}
.journal-actions-cell form{
    margin-top:8px;
}
.journal-row-edit{
    min-width:180px;
}
.journal-row-edit summary{
    cursor:pointer;
    font-weight:700;
}
.journal-inline-edit{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    min-width:360px;
    margin-top:8px;
    padding:10px;
    border:1px solid var(--ui-border, var(--line));
    border-radius:10px;
    background:var(--ui-card-soft, #f7f7f1);
}
.journal-inline-edit .wide{
    grid-column:1 / -1;
}
html.theme-dark .journal-forms details,
html.theme-dark .journal-period,
html.theme-dark .journal-stats div,
html.theme-dark .journal-table-wrap,
html.theme-dark .journal-inline-edit,
html.theme-dark .journal-average{
    background:var(--ui-card, #3d473d)!important;
    color:var(--ui-text, #f7f1e6)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .journal-forms summary,
html.theme-dark .journal-table td,
html.theme-dark .journal-table th,
html.theme-dark .journal-head h2,
html.theme-dark .journal-stats b,
html.theme-dark .journal-average{
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .journal-period span,
html.theme-dark .journal-stats span{
    color:var(--ui-muted, #d9d1c2)!important;
}
@media(max-width:1100px){
    .journal-stats{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
    .journal-forms,
    .journal-two-columns{
        grid-template-columns:1fr;
    }
}
@media(max-width:720px){
    .journal-head{
        display:block;
    }
    .journal-period{
        margin-top:10px;
        text-align:left;
    }
    .journal-stats{
        grid-template-columns:1fr;
    }
    .journal-form{
        grid-template-columns:1fr;
    }
    .journal-inline-edit{
        grid-template-columns:1fr;
        min-width:260px;
    }
}


/* gradebook-style journal */
.gradebook-journal{
    background:var(--ui-card, #fff)!important;
}
.gradebook-title{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:18px;
    padding-bottom:14px;
    margin-bottom:14px;
    border-bottom:2px solid var(--ui-border, #d4d9ce);
}
.gradebook-title h2{
    margin:0 0 6px!important;
    font-size:28px!important;
    letter-spacing:0!important;
}
.gradebook-date{
    min-width:130px;
    padding:10px 12px;
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
    text-align:center;
}
.gradebook-date span{
    display:block;
    color:var(--ui-muted, #667166);
    font-size:12px;
}
.gradebook-date b{
    display:block;
    margin-top:2px;
}
.gradebook-summary{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    border:1px solid var(--ui-border, #d4d9ce);
    margin-bottom:16px;
}
.gradebook-summary div{
    padding:10px 12px;
    border-right:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
}
.gradebook-summary div:last-child{
    border-right:0;
}
.gradebook-summary span{
    display:block;
    color:var(--ui-muted, #667166);
    font-size:12px;
}
.gradebook-summary b{
    display:block;
    margin-top:3px;
    font-size:22px;
}
.gradebook-quick-entry{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px;
    margin-bottom:18px;
}
.gradebook-quick-entry details{
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
}
.gradebook-quick-entry summary{
    padding:10px 12px;
    cursor:pointer;
    font-weight:700;
}
.gradebook-form{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    padding:0 12px 12px;
}
.gradebook-form .wide{
    grid-column:1 / -1;
}
.gradebook-form button{
    justify-self:start;
}
.gradebook-section{
    margin-top:18px;
    padding-top:16px;
    border-top:2px solid var(--ui-border, #d4d9ce);
}
.gradebook-class{
    border:1px solid var(--ui-border, #d4d9ce);
    margin-bottom:12px;
    background:var(--ui-card, #fff);
}
.gradebook-class > summary{
    display:flex;
    justify-content:space-between;
    gap:12px;
    padding:12px 14px;
    cursor:pointer;
    font-weight:800;
    background:var(--ui-card-soft, #f1f4ee);
    border-bottom:1px solid var(--ui-border, #d4d9ce);
}
.gradebook-class > summary em{
    font-style:normal;
    font-weight:400;
    color:var(--ui-muted, #667166);
}
.gradebook-table-wrap{
    width:100%;
    overflow:auto;
}
.gradebook-table,
.journal-ledger-table{
    width:100%;
    min-width:1100px;
    border-collapse:collapse;
    font-size:14px;
    background:var(--ui-card, #fff);
}
.gradebook-table th,
.gradebook-table td,
.journal-ledger-table th,
.journal-ledger-table td{
    border:1px solid var(--ui-border, #d4d9ce)!important;
    padding:8px 7px!important;
    vertical-align:top;
}
.gradebook-table th,
.journal-ledger-table th{
    background:var(--ui-card-soft, #f1f4ee)!important;
    color:var(--ui-text, #202020)!important;
    font-weight:800;
    text-align:center;
}
.gradebook-table tbody tr:nth-child(even) td,
.journal-ledger-table tbody tr:nth-child(even) td{
    background:rgba(0,0,0,.018)!important;
}
.num-col{
    width:46px;
    text-align:center;
}
.student-col{
    min-width:220px;
    position:sticky;
    left:0;
    z-index:2;
    background:var(--ui-card, #fff)!important;
}
th.student-col{
    background:var(--ui-card-soft, #f1f4ee)!important;
    z-index:3;
}
.student-col span{
    display:block;
    color:var(--ui-muted, #667166);
    font-size:12px;
}
.subject-col{
    min-width:116px;
    max-width:140px;
}
.marks-cell{
    text-align:center;
    white-space:nowrap;
}
.grade-dot{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:24px;
    height:24px;
    margin:1px;
    padding:0 6px;
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card, #fff);
    font-weight:800;
    line-height:1;
}
.grade-dot.m5{color:#d47a1f}
.grade-dot.m4{color:#315b85}
.grade-dot.m3{color:#9a6a13}
.grade-dot.m2{color:#9b2f2f}
.empty-mark{
    color:var(--ui-muted, #667166);
}
.avg-badge{
    display:inline-flex;
    min-width:38px;
    justify-content:center;
    padding:3px 8px;
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
    font-weight:800;
}
.gradebook-table small{
    display:block;
    color:var(--ui-muted, #667166);
}
.journal-columns{
    display:grid;
    grid-template-columns:minmax(0,1.35fr) minmax(320px,.65fr);
    gap:16px;
}
.ledger-edit summary{
    cursor:pointer;
    font-weight:700;
    margin-bottom:6px;
}
.ledger-edit-form{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    min-width:360px;
    max-width:520px;
    padding:10px;
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
}
.ledger-edit-form .wide{
    grid-column:1 / -1;
}
.ledger-list{
    display:grid;
    gap:10px;
}
.ledger-list h3{
    margin:8px 0 0!important;
    font-size:17px!important;
}
.ledger-item{
    border:1px solid var(--ui-border, #d4d9ce);
    background:var(--ui-card-soft, #f1f4ee);
    padding:10px;
}
.ledger-item b,
.ledger-item span{
    display:block;
}
.ledger-item span{
    margin-top:3px;
    color:var(--ui-muted, #667166);
}
.ledger-item form{
    margin-top:8px;
}
html.theme-dark .gradebook-class,
html.theme-dark .gradebook-table,
html.theme-dark .journal-ledger-table,
html.theme-dark .gradebook-table td,
html.theme-dark .journal-ledger-table td,
html.theme-dark .student-col{
    background:var(--ui-card, #3d473d)!important;
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .gradebook-class > summary,
html.theme-dark .gradebook-table th,
html.theme-dark .journal-ledger-table th,
html.theme-dark .gradebook-summary div,
html.theme-dark .gradebook-quick-entry details,
html.theme-dark .ledger-edit-form,
html.theme-dark .ledger-item,
html.theme-dark .avg-badge{
    background:var(--ui-card-soft, #465146)!important;
    color:var(--ui-text, #f7f1e6)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .grade-dot{
    background:var(--ui-card, #3d473d)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .grade-dot.m5{color:#e2e2e2!important}
html.theme-dark .grade-dot.m4{color:#dfc284!important}
html.theme-dark .grade-dot.m3{color:#e5b36b!important}
html.theme-dark .grade-dot.m2{color:#e0a19a!important}
@media(max-width:1150px){
    .gradebook-quick-entry,
    .journal-columns{
        grid-template-columns:1fr;
    }
    .gradebook-summary{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}
@media(max-width:720px){
    .gradebook-title{
        display:block;
    }
    .gradebook-date{
        margin-top:10px;
        text-align:left;
    }
    .gradebook-summary{
        grid-template-columns:1fr;
    }
    .gradebook-form,
    .ledger-edit-form{
        grid-template-columns:1fr;
    }
}


/* student grades in people tab */
.people-grades-panel{
    margin-top:16px!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-radius:10px!important;
    background:var(--ui-card, #fff)!important;
    padding:14px!important;
    color:var(--ui-text, var(--ink))!important;
}
.people-grades-table-wrap{
    width:100%;
    max-width:100%;
    overflow:auto;
    border:1px solid var(--ui-border, var(--line));
    border-radius:8px;
    background:var(--ui-card, #fff);
}
.people-grades-table{
    width:100%;
    min-width:760px;
    border-collapse:collapse;
}
.people-grades-table th,
.people-grades-table td{
    padding:9px 10px;
    border-bottom:1px solid var(--ui-border, var(--line));
    vertical-align:top;
}
.people-grades-table th{
    background:var(--ui-card-soft, #f1f4ee);
    color:var(--ui-muted, var(--muted));
    font-weight:700;
}
.people-grades-table tr:last-child td{
    border-bottom:0;
}
html.theme-dark .people-grades-panel,
html.theme-dark .people-grades-table-wrap,
html.theme-dark .people-grades-table,
html.theme-dark .people-grades-table td{
    background:var(--ui-card, #3d473d)!important;
    color:var(--ui-text, #f7f1e6)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .people-grades-table th{
    background:var(--ui-card-soft, #465146)!important;
    color:var(--ui-muted, #d9d1c2)!important;
    border-color:var(--ui-border, #74806f)!important;
}


/* modal window for student grades in people tab */
.people-grades-panel{
    margin:0!important;
}
.people-grades-panel:not(.is-hidden){
    position:fixed!important;
    inset:0!important;
    z-index:5000!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:28px!important;
    background:rgba(15,20,16,.58)!important;
    border:0!important;
    border-radius:0!important;
    color:var(--ui-text, var(--ink))!important;
}
.people-grades-panel > .class-students-head,
.people-grades-panel > .people-grades-table-wrap,
.people-grades-panel > .empty{
    width:min(980px, 100%)!important;
}
.people-grades-panel:not(.is-hidden) > .class-students-head{
    position:absolute!important;
    top:calc(50% - min(38vh, 360px))!important;
    left:50%!important;
    transform:translateX(-50%)!important;
    z-index:2!important;
    margin:0!important;
    padding:16px 18px!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-bottom:0!important;
    border-radius:14px 14px 0 0!important;
    background:var(--ui-card, #fff)!important;
    color:var(--ui-text, var(--ink))!important;
}
.people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
.people-grades-panel:not(.is-hidden) > .empty{
    max-height:min(62vh, 560px)!important;
    margin-top:76px!important;
    overflow:auto!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-radius:0 0 14px 14px!important;
    background:var(--ui-card, #fff)!important;
    box-shadow:0 24px 70px rgba(0,0,0,.32)!important;
}
.people-grades-panel .class-students-head h3{
    margin:0 0 4px!important;
}
.people-grades-panel [data-close-student-grades]{
    align-self:flex-start!important;
}
html.theme-dark .people-grades-panel:not(.is-hidden){
    background:rgba(10,14,11,.68)!important;
}
html.theme-dark .people-grades-panel:not(.is-hidden) > .class-students-head,
html.theme-dark .people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
html.theme-dark .people-grades-panel:not(.is-hidden) > .empty{
    background:var(--ui-card, #3d473d)!important;
    color:var(--ui-text, #f7f1e6)!important;
    border-color:var(--ui-border, #74806f)!important;
}
@media(max-width:720px){
    .people-grades-panel:not(.is-hidden){
        padding:14px!important;
        align-items:flex-start!important;
    }
    .people-grades-panel:not(.is-hidden) > .class-students-head{
        position:static!important;
        transform:none!important;
        width:100%!important;
        margin-top:24px!important;
    }
    .people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
    .people-grades-panel:not(.is-hidden) > .empty{
        width:100%!important;
        max-height:calc(100vh - 140px)!important;
        margin-top:0!important;
    }
}


/* clean admin buttons and controls */
.admin-tabs{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:6px!important;
    padding:8px!important;
    margin:0 0 18px!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-radius:10px!important;
    background:var(--ui-card-soft, #f1f4ee)!important;
    box-shadow:none!important;
}
.admin-tabs button{
    flex:0 1 auto!important;
    min-width:0!important;
    min-height:38px!important;
    padding:8px 14px!important;
    border:1px solid transparent!important;
    border-radius:8px!important;
    background:transparent!important;
    color:var(--ui-text, var(--ink))!important;
    font-size:14px!important;
    font-weight:700!important;
    line-height:1.2!important;
    text-align:center!important;
    box-shadow:none!important;
}
.admin-tabs button:hover{
    background:var(--ui-card, #fff)!important;
    border-color:var(--ui-border, var(--line))!important;
}
.admin-tabs button.is-active{
    background:var(--ui-card, #fff)!important;
    border-color:var(--ui-green, #d47a1f)!important;
    color:var(--ui-text, var(--ink))!important;
    box-shadow:none!important;
}

/* top action controls */
.admin-actions,
.row-actions,
.edit-actions,
.request-actions,
.mini-list-actions,
.list-tools-side{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex-wrap:wrap!important;
    gap:6px!important;
}
.admin-actions{
    min-width:210px!important;
}
.admin-actions form{
    margin:0!important;
}
.admin-actions .btn-small,
.admin-actions button,
.row-actions .btn-small,
.edit-actions .btn-small,
.request-actions .btn-small,
.mini-list-actions .btn-small,
.subject-teacher-form .btn-small,
.list-tools-side .btn-small{
    min-height:34px!important;
    padding:7px 12px!important;
    border-radius:7px!important;
    font-size:13px!important;
    font-weight:700!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    box-shadow:none!important;
}

/* neutral button system */
.btn-small,
button.btn-small,
.admin-page .btn-small{
    border:1px solid var(--ui-border, var(--line))!important;
    background:var(--ui-card-soft, #f1f4ee)!important;
    color:var(--ui-text, var(--ink))!important;
}
.btn-small:hover,
button.btn-small:hover,
.admin-page .btn-small:hover{
    background:var(--ui-card, #fff)!important;
    border-color:var(--ui-green, #d47a1f)!important;
}
.btn-light,
.admin-page .btn-light{
    border-color:var(--ui-border, var(--line))!important;
    background:var(--ui-card, #fff)!important;
    color:var(--ui-text, var(--ink))!important;
}
.btn-danger-light,
.admin-page .btn-danger-light{
    border-color:#d9b7ae!important;
    background:#f7eee9!important;
    color:#7f3d35!important;
}
.btn-danger-light:hover,
.admin-page .btn-danger-light:hover{
    border-color:#a65b50!important;
    background:#f2dfd8!important;
    color:#6f3029!important;
}

/* primary save buttons stay reserved, not neon */
.subject-save-btn,
.edit-actions button[type="submit"],
.request-actions button[type="submit"],
.password-change-form button[type="submit"],
form[data-edit-user-form] button[type="submit"]{
    border-color:var(--ui-green, #d47a1f)!important;
    background:var(--ui-green, #d47a1f)!important;
    color:#fff!important;
}
.subject-save-btn:hover,
.edit-actions button[type="submit"]:hover,
.request-actions button[type="submit"]:hover,
.password-change-form button[type="submit"]:hover,
form[data-edit-user-form] button[type="submit"]:hover{
    background:var(--ui-green-hover, #e08a2f)!important;
    border-color:var(--ui-green-hover, #e08a2f)!important;
}

/* people table buttons: compact and readable */
.people-table td.right{
    min-width:260px!important;
}
.people-table .admin-actions{
    display:grid!important;
    grid-template-columns:repeat(2, minmax(96px, 1fr))!important;
    gap:6px!important;
    justify-content:stretch!important;
    align-items:stretch!important;
}
.people-table .admin-actions > button,
.people-table .admin-actions > form{
    width:100%!important;
}
.people-table .admin-actions button{
    width:100%!important;
}
.people-table [data-open-student-grades]{
    border-color:#b8c9ae!important;
    background:#eef4ea!important;
    color:#202020!important;
}
.people-table [data-open-student-grades]:hover{
    border-color:var(--ui-green, #d47a1f)!important;
    background:#e4eddf!important;
}

/* filter/search panel */
.list-tools{
    border-radius:10px!important;
    padding:12px 14px!important;
    background:var(--ui-card-soft, #f1f4ee)!important;
    box-shadow:none!important;
}
.list-search input,
.class-filter select{
    min-height:38px!important;
    border-radius:8px!important;
}
.list-tools-side .list-toggle{
    min-width:124px!important;
}

/* table header/button density */
.people-table th,
.people-table td{
    padding:12px 14px!important;
}
.badge{
    border-radius:999px!important;
    padding:5px 10px!important;
    font-size:12px!important;
    font-weight:700!important;
}

/* dark theme readability for buttons */
html.theme-dark .admin-tabs{
    background:var(--ui-card-soft, #465146)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .admin-tabs button{
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .admin-tabs button:hover{
    background:var(--ui-card, #3d473d)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .admin-tabs button.is-active{
    background:var(--ui-green, #e08a2f)!important;
    border-color:var(--ui-green, #e08a2f)!important;
    color:#202020!important;
}
html.theme-dark .btn-small,
html.theme-dark button.btn-small,
html.theme-dark .admin-page .btn-small{
    background:var(--ui-card-soft, #465146)!important;
    border-color:var(--ui-border, #74806f)!important;
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .btn-small:hover,
html.theme-dark button.btn-small:hover,
html.theme-dark .admin-page .btn-small:hover{
    background:var(--ui-card, #3d473d)!important;
    border-color:var(--ui-green, #e08a2f)!important;
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .people-table [data-open-student-grades]{
    background:var(--ui-card-soft, #465146)!important;
    border-color:var(--ui-border, #74806f)!important;
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .subject-save-btn,
html.theme-dark .edit-actions button[type="submit"],
html.theme-dark .request-actions button[type="submit"],
html.theme-dark .password-change-form button[type="submit"],
html.theme-dark form[data-edit-user-form] button[type="submit"]{
    background:var(--ui-green, #e08a2f)!important;
    border-color:var(--ui-green, #e08a2f)!important;
    color:#202020!important;
}
html.theme-dark .btn-danger-light,
html.theme-dark .admin-page .btn-danger-light{
    background:#57413d!important;
    border-color:#9b756e!important;
    color:#f4d0ca!important;
}

@media(max-width:900px){
    .people-table td.right{
        min-width:210px!important;
    }
    .people-table .admin-actions{
        grid-template-columns:1fr!important;
    }
}
@media(max-width:720px){
    .admin-tabs{
        display:grid!important;
        grid-template-columns:1fr!important;
    }
    .admin-tabs button{
        width:100%!important;
    }
    .list-tools{
        display:grid!important;
        grid-template-columns:1fr!important;
    }
    .list-tools-side{
        justify-content:flex-start!important;
    }
}


/* visible close button for student grades modal */
.people-grades-panel:not(.is-hidden){
    position:fixed!important;
    inset:0!important;
    z-index:5000!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    padding:28px!important;
    background:rgba(15,20,16,.62)!important;
}
.people-grades-panel:not(.is-hidden) > .class-students-head{
    position:relative!important;
    top:auto!important;
    left:auto!important;
    transform:none!important;
    width:min(980px, 100%)!important;
    margin:0!important;
    padding:16px 56px 14px 18px!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-bottom:0!important;
    border-radius:14px 14px 0 0!important;
    background:var(--ui-card, #fff)!important;
    color:var(--ui-text, var(--ink))!important;
}
.people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
.people-grades-panel:not(.is-hidden) > .empty{
    width:min(980px, 100%)!important;
    max-height:min(62vh, 560px)!important;
    margin:0!important;
    overflow:auto!important;
    border:1px solid var(--ui-border, var(--line))!important;
    border-radius:0 0 14px 14px!important;
    background:var(--ui-card, #fff)!important;
    box-shadow:0 24px 70px rgba(0,0,0,.32)!important;
}
.modal-close-x,
.people-grades-panel [data-close-student-grades]{
    position:absolute!important;
    top:12px!important;
    right:14px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:34px!important;
    height:34px!important;
    min-width:34px!important;
    min-height:34px!important;
    padding:0!important;
    border-radius:50%!important;
    border:1px solid var(--ui-border, var(--line))!important;
    background:var(--ui-card-soft, #f1f4ee)!important;
    color:var(--ui-text, var(--ink))!important;
    font-size:24px!important;
    line-height:1!important;
    font-weight:700!important;
    box-shadow:none!important;
}
.modal-close-x:hover,
.people-grades-panel [data-close-student-grades]:hover{
    background:var(--ui-card-warm, #eee3d1)!important;
    color:var(--ui-text, var(--ink))!important;
}
html.theme-dark .people-grades-panel:not(.is-hidden){
    background:rgba(10,14,11,.70)!important;
}
html.theme-dark .people-grades-panel:not(.is-hidden) > .class-students-head,
html.theme-dark .people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
html.theme-dark .people-grades-panel:not(.is-hidden) > .empty{
    background:var(--ui-card, #3d473d)!important;
    color:var(--ui-text, #f7f1e6)!important;
    border-color:var(--ui-border, #74806f)!important;
}
html.theme-dark .modal-close-x,
html.theme-dark .people-grades-panel [data-close-student-grades]{
    background:var(--ui-card-soft, #465146)!important;
    border-color:var(--ui-border, #74806f)!important;
    color:var(--ui-text, #f7f1e6)!important;
}
html.theme-dark .modal-close-x:hover,
html.theme-dark .people-grades-panel [data-close-student-grades]:hover{
    background:var(--ui-card, #3d473d)!important;
}
@media(max-width:720px){
    .people-grades-panel:not(.is-hidden){
        justify-content:flex-start!important;
        padding:14px!important;
    }
    .people-grades-panel:not(.is-hidden) > .class-students-head{
        width:100%!important;
        margin-top:24px!important;
    }
    .people-grades-panel:not(.is-hidden) > .people-grades-table-wrap,
    .people-grades-panel:not(.is-hidden) > .empty{
        width:100%!important;
        max-height:calc(100vh - 150px)!important;
    }
}


/* admin schedule tab */
.schedule-admin-grid{
    display:grid;
    grid-template-columns:minmax(280px,420px) minmax(0,1fr);
    gap:16px;
    margin-bottom:18px;
}
.schedule-admin-form,
.schedule-admin-help,
.schedule-admin-list{
    border:1px solid var(--ui-border,var(--line));
    background:var(--ui-card-soft,#f1f4ee);
    padding:16px;
}
.schedule-admin-form{
    display:grid;
    gap:10px;
}
.schedule-admin-form h3,
.schedule-admin-help h3{
    margin:0 0 8px;
}
.schedule-admin-form label{
    display:block;
}
.schedule-admin-help ol{
    margin:0;
    padding-left:20px;
    color:var(--ui-muted,var(--muted));
}
.schedule-admin-help li{
    margin:8px 0;
}
.schedule-table-wrap{
    width:100%;
    overflow:auto;
    border:1px solid var(--ui-border,var(--line));
    background:var(--ui-card,#fff);
}
.schedule-table{
    width:100%;
    min-width:920px;
    border-collapse:collapse;
}
.schedule-table th,
.schedule-table td{
    padding:10px;
    border-bottom:1px solid var(--ui-border,var(--line));
    vertical-align:top;
}
.schedule-table th{
    background:var(--ui-card-soft,#f1f4ee);
    color:var(--ui-muted,var(--muted));
    text-align:left;
}
.schedule-edit summary{
    cursor:pointer;
    font-weight:800;
    margin-bottom:8px;
}
.schedule-edit-form{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    min-width:380px;
    margin:8px 0;
    padding:10px;
    border:1px solid var(--ui-border,var(--line));
    background:var(--ui-card-soft,#f1f4ee);
}
.schedule-edit-form button{
    justify-self:start;
}
html.theme-dark .schedule-admin-form,
html.theme-dark .schedule-admin-help,
html.theme-dark .schedule-admin-list,
html.theme-dark .schedule-table-wrap,
html.theme-dark .schedule-table td,
html.theme-dark .schedule-edit-form{
    background:var(--ui-card,#3d473d)!important;
    color:var(--ui-text,#f7f1e6)!important;
    border-color:var(--ui-border,#74806f)!important;
}
html.theme-dark .schedule-table th{
    background:var(--ui-card-soft,#465146)!important;
    color:var(--ui-muted,#d9d1c2)!important;
    border-color:var(--ui-border,#74806f)!important;
}
@media(max-width:980px){
    .schedule-admin-grid{
        grid-template-columns:1fr;
    }
}
@media(max-width:680px){
    .schedule-edit-form{
        grid-template-columns:1fr;
        min-width:260px;
    }
}


/* unified neutral design: no blue/green palette */
:root{
    --ui-bg:#ece7df;
    --ui-page:#f7f3ed;
    --ui-card:#fffaf4;
    --ui-card-soft:#eee7de;
    --ui-card-warm:#e7dacb;
    --ui-border:#cfc3b7;
    --ui-text:#25211d;
    --ui-muted:#70685f;
    --ui-green:#7a5944;
    --ui-green-hover:#634635;
    --ui-red:#8c4038;
    --ui-shadow:none;
    --neutral-accent:#7a5944;
    --neutral-accent-hover:#634635;
}
html.theme-dark{
    --ui-bg:#242220;
    --ui-page:#2b2825;
    --ui-card:#34302c;
    --ui-card-soft:#3d3833;
    --ui-card-warm:#4a4037;
    --ui-border:#6a5f55;
    --ui-text:#f4eee6;
    --ui-muted:#cfc4b8;
    --ui-green:#c8a17f;
    --ui-green-hover:#d5b191;
    --ui-red:#e0a19a;
    --ui-shadow:none;
    --neutral-accent:#c8a17f;
    --neutral-accent-hover:#d5b191;
}
html, body{
    background:var(--ui-bg)!important;
    color:var(--ui-text)!important;
}
.sheet,
main{
    background:var(--ui-page)!important;
    color:var(--ui-text)!important;
}
.site-header,
.site-footer,
.panel,
.stat,
.desk-card,
.admin-cover,
.admin-stat,
.admin-note,
.admin-tab-panel,
.service-grid > div,
.people-create,
.user-card,
.list-tools,
.class-pill,
.teacher-simple,
.teacher-simple-head,
.teacher-simple-panel,
.teacher-simple-form,
.teacher-simple-table,
.teacher-simple-stack,
.learner-shell,
.learner-stat,
.learner-panel,
.learner-card,
.parent-admin-box,
.schedule-admin-form,
.schedule-admin-list,
.schedule-admin-help,
.schedule-table-wrap,
.schedule-table td,
.schedule-edit-form{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:none!important;
}
.panel.tinted,
.empty,
.admin-tabs,
.teacher-simple-tabs,
.learner-tabs,
.teacher-empty,
.learner-empty,
.parent-empty,
.badge,
.teacher-badge,
.teacher-chip,
.learner-badge,
.learner-item,
.parent-child-list a,
.schedule-table th,
.people-grades-table th,
th{
    background:var(--ui-card-soft)!important;
    color:var(--ui-muted)!important;
    border-color:var(--ui-border)!important;
}
a{
    color:var(--neutral-accent)!important;
}
.site-nav a,
button,
.btn,
.btn-small,
.admin-page button,
.admin-page .btn,
.admin-page .btn-small,
.teacher-simple button{
    border-color:var(--ui-border)!important;
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    box-shadow:none!important;
}
button:hover,
.btn:hover,
.btn-small:hover,
.admin-page button:hover,
.admin-page .btn:hover,
.admin-page .btn-small:hover,
.teacher-simple button:hover{
    background:var(--ui-card-warm)!important;
    border-color:var(--neutral-accent)!important;
    color:var(--ui-text)!important;
}
button[type="submit"],
.btn-primary,
.home-btn-primary,
.reference-primary,
.schedule-compact-form button,
.teacher-simple-form button{
    background:var(--neutral-accent)!important;
    border-color:var(--neutral-accent)!important;
    color:#fffaf4!important;
}
html.theme-dark button[type="submit"],
html.theme-dark .btn-primary,
html.theme-dark .home-btn-primary,
html.theme-dark .reference-primary,
html.theme-dark .schedule-compact-form button,
html.theme-dark .teacher-simple-form button{
    color:#241f1b!important;
}
.btn-danger-light,
.admin-page .btn-danger-light{
    color:var(--ui-red)!important;
    background:var(--ui-card)!important;
    border-color:var(--ui-border)!important;
}
input,
select,
textarea{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
select option{
    background:#fffaf4!important;
    color:#25211d!important;
}
html.theme-dark select option{
    background:#fffaf4!important;
    color:#25211d!important;
}
h1,h2,h3,h4,
.site-brand strong,
.admin-cover h1,
.teacher-simple h1,
.learner-head h1,
.parent-admin-head h1{
    color:var(--ui-text)!important;
}
p,
.muted,
.small-muted,
.list-count,
.site-brand span,
.site-footer span,
.admin-cover p,
.admin-stat span,
.teacher-simple-stats span,
.learner-stat span,
.learner-head p,
.learner-section-head p,
.parent-admin-head p{
    color:var(--ui-muted)!important;
}
.admin-cover p,
.admin-cover .stamp,
.section-head p,
.teacher-diary-note,
.teacher-section-head p,
.learner-section-head p{
    display:none!important;
}

/* simplified teacher */
.teacher-simple{
    border:1px solid var(--ui-border);
    padding:20px;
}
.teacher-simple-head{
    display:flex;
    align-items:end;
    justify-content:space-between;
    gap:18px;
    padding-bottom:14px;
    border-bottom:1px solid var(--ui-border);
}
.teacher-simple-head h1{
    margin:0 0 4px;
    font-size:34px;
}
.teacher-simple-head span,
.teacher-simple-date{
    color:var(--ui-muted);
}
.teacher-simple-date{
    border:1px solid var(--ui-border);
    background:var(--ui-card-soft);
    padding:8px 12px;
    font-weight:700;
}
.teacher-simple-stats{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin:14px 0;
}
.teacher-simple-stats div{
    border:1px solid var(--ui-border);
    background:var(--ui-card-soft);
    padding:12px;
}
.teacher-simple-stats b{
    display:block;
    font-size:24px;
}
.teacher-simple-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    padding:8px;
    margin-bottom:14px;
    border:1px solid var(--ui-border);
}
.teacher-simple-tabs a{
    display:flex;
    align-items:center;
    min-height:36px;
    padding:0 12px;
    border:1px solid transparent;
    color:var(--ui-text)!important;
    text-decoration:none!important;
    font-weight:800;
}
.teacher-simple-tabs a.active,
.teacher-simple-tabs a:hover{
    background:var(--ui-card);
    border-color:var(--ui-border);
}
.teacher-simple-panel{
    display:none;
    border:1px solid var(--ui-border);
    padding:16px;
}
.teacher-simple-panel.active{
    display:block;
}
.teacher-simple-grid{
    display:grid;
    grid-template-columns:320px minmax(0,1fr);
    gap:14px;
}
.teacher-simple-form{
    border:1px solid var(--ui-border);
    padding:14px;
    display:grid;
    gap:9px;
}
.teacher-simple-stack{
    display:grid;
    gap:14px;
}
.teacher-simple-form h2,
.teacher-simple-table h2{
    margin:0 0 8px;
    font-size:20px;
}
.teacher-simple-table{
    border:1px solid var(--ui-border);
    padding:14px;
}
.teacher-simple .table-scroll{
    width:100%;
    overflow:auto;
    border:1px solid var(--ui-border);
}
.teacher-simple table{
    min-width:720px;
}
.mark,
.teacher-mark{
    color:var(--ui-text)!important;
    background:var(--ui-card-soft)!important;
    border-color:var(--ui-border)!important;
}

/* compact admin schedule */
.schedule-compact-form{
    display:grid;
    grid-template-columns:repeat(7,minmax(0,1fr));
    gap:10px;
    align-items:end;
    margin-bottom:16px;
    padding:14px;
    border:1px solid var(--ui-border);
    background:var(--ui-card-soft);
}
.schedule-compact-form label{
    margin:0;
}
.schedule-compact-form button{
    min-height:40px;
}
.schedule-admin-list{
    padding:14px;
    border:1px solid var(--ui-border);
}
.schedule-table-wrap{
    border:1px solid var(--ui-border);
    overflow:auto;
}
.schedule-table{
    min-width:920px;
}

/* day plan */
.day-plan-form{
    display:flex;
    flex-wrap:wrap;
    align-items:end;
    gap:10px;
    margin-bottom:14px;
    padding:12px;
    border:1px solid var(--ui-border);
    background:var(--ui-card-soft);
}
.day-plan-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}

@media(max-width:1100px){
    .schedule-compact-form{
        grid-template-columns:repeat(3,minmax(0,1fr));
    }
    .teacher-simple-grid{
        grid-template-columns:1fr;
    }
}
@media(max-width:720px){
    .teacher-simple,
    .teacher-simple-panel{
        padding:12px;
    }
    .teacher-simple-head{
        display:block;
    }
    .teacher-simple-date{
        display:inline-block;
        margin-top:10px;
    }
    .teacher-simple-stats,
    .schedule-compact-form,
    .day-plan-grid{
        grid-template-columns:1fr;
    }
    .teacher-simple-tabs a{
        flex:1 1 100%;
    }
}



/* rollback visual, logic preserved, no green */
:root{
    --ui-bg:#eeeeee!important;
    --ui-page:#f7f7f7!important;
    --ui-card:#ffffff!important;
    --ui-card-soft:#eeeeee!important;
    --ui-card-warm:#e2e2e2!important;
    --ui-border:#c8c8c8!important;
    --ui-text:#202020!important;
    --ui-muted:#666666!important;
    --ui-green:#d47a1f!important;
    --ui-green-hover:#b86519!important;
    --ui-red:#b84b2f!important;
    --accent:#d47a1f!important;
    --accent2:#d47a1f!important;
    --ok:#d47a1f!important;
    --neutral-accent:#d47a1f!important;
    --neutral-accent-hover:#b86519!important;
    --pa-accent:#d47a1f!important;
    --pa-line:#c8c8c8!important;
    --pa-card:#ffffff!important;
    --pa-soft:#eeeeee!important;
    --pa-ink:#202020!important;
    --pa-muted:#666666!important;
}
html.theme-dark{
    --ui-bg:#121212!important;
    --ui-page:#181818!important;
    --ui-card:#222222!important;
    --ui-card-soft:#2c2c2c!important;
    --ui-card-warm:#373737!important;
    --ui-border:#4a4a4a!important;
    --ui-text:#f2f2f2!important;
    --ui-muted:#b8b8b8!important;
    --ui-green:#e08a2f!important;
    --ui-green-hover:#f0a14a!important;
    --ui-red:#df6b4b!important;
    --accent:#e08a2f!important;
    --accent2:#e08a2f!important;
    --ok:#e08a2f!important;
    --neutral-accent:#e08a2f!important;
    --neutral-accent-hover:#f0a14a!important;
    --pa-accent:#e08a2f!important;
    --pa-line:#4a4a4a!important;
    --pa-card:#222222!important;
    --pa-soft:#2c2c2c!important;
    --pa-ink:#f2f2f2!important;
    --pa-muted:#b8b8b8!important;
}
html,body{background:var(--ui-bg)!important;color:var(--ui-text)!important}
.sheet,main{background:var(--ui-page)!important;color:var(--ui-text)!important}
.site-header,.site-footer,
.admin-page,.admin-cover,.admin-stat,.admin-note,.admin-tab-panel,
.desk-card,.service-grid>div,.people-create,.user-card,.list-tools,.class-pill,
.teacher-simple,.teacher-simple-panel,.teacher-simple-form,.teacher-simple-table,.teacher-simple-stack,
.learner-shell,.learner-panel,.learner-card,.parent-admin-box,
.schedule-admin-form,.schedule-admin-list,.schedule-admin-help,.schedule-table-wrap,
.panel,.stat,.login-box,.hero-card,.people-grades-panel{
    background:var(--ui-card)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:none!important;
}
.admin-cover,.admin-head{background:var(--ui-card)!important;background-image:none!important}
.admin-cover:before,.admin-cover:after,.admin-head:before,.admin-head:after{display:none!important;content:none!important}
.admin-tabs,.teacher-simple-tabs,.learner-tabs,.schedule-compact-form,
.panel.tinted,.empty,.badge,.teacher-badge,.teacher-chip,.learner-badge,.learner-item,
.schedule-table th,.teacher-simple th,.people-grades-table th,th{
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
.admin-stat strong,.admin-stat b,.admin-stat .num,.admin-today strong,.admin-today b,.stat strong,.stat b,
.reference-stats strong,.mono-metrics b,.mark,.teacher-mark,.grade-dot,.avg-badge,.journal-average,
.mark.m5,.teacher-mark.m5,.grade-dot.m5,
.mark.m4,.teacher-mark.m4,.grade-dot.m4,
.mark.m3,.teacher-mark.m3,.grade-dot.m3,
.mark.m2,.teacher-mark.m2,.grade-dot.m2{
    color:var(--accent)!important;
}
.admin-tabs button,.teacher-simple-tabs a,.learner-tabs a,
button,.btn,.btn-small,.site-nav a{
    background:var(--ui-card-soft)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:none!important;
}
.admin-tabs button.is-active,.teacher-simple-tabs a.active,.learner-tabs a.active,
button[type="submit"],.site-nav .logout-link,.logout-link,.site-nav a[href="#request"],.nav-accent{
    background:var(--accent)!important;
    border-color:var(--accent)!important;
    color:#fff!important;
}
html.theme-dark .admin-tabs button.is-active,
html.theme-dark .teacher-simple-tabs a.active,
html.theme-dark .learner-tabs a.active,
html.theme-dark button[type="submit"],
html.theme-dark .site-nav .logout-link,
html.theme-dark .logout-link,
html.theme-dark .site-nav a[href="#request"],
html.theme-dark .nav-accent{color:#151515!important}
button:hover,.btn:hover,.btn-small:hover,.site-nav a:hover,.admin-tabs button:hover,.teacher-simple-tabs a:hover,.learner-tabs a:hover{
    background:var(--ui-card-warm)!important;
    border-color:var(--accent)!important;
    color:var(--ui-text)!important;
}
input,select,textarea{background:var(--ui-card)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
h1,h2,h3,h4,.site-brand strong,.admin-cover h1{color:var(--ui-text)!important}
p,.muted,.small-muted,.site-brand span,.site-footer span,.list-count,.admin-stat span{color:var(--ui-muted)!important}
.site-brand__mark,.brand-mark,.theme-switch__thumb{
    background:var(--accent)!important;
    border-color:var(--accent)!important;
    color:#fff!important;
}
body:has(.reference-home) .reference-hero,body:has(.mono-home) .mono-hero{
    background:linear-gradient(180deg,var(--ui-page),var(--ui-bg))!important;
}
.reference-hero h1 span,.mono-hero h1 span{color:var(--accent)!important}
