body.school-portal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.school-portal .site-header.is-sticky {
    position: sticky;
    top: 0;
    z-index: 40;
}
.portal-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 8px;
}
.portal-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    background: rgba(255,255,255,.12);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--header-text);
    flex: 0 0 36px;
    overflow: hidden;
}
.portal-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portal-user-meta { min-width: 0; line-height: 1.2; }
.portal-user-meta strong { display: block; font-size: 13px; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-user-meta span { display: block; font-size: 11px; opacity: .8; }
.portal-logout {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.35);
    color: var(--header-text);
    background: transparent;
    display: grid;
    place-items: center;
    text-decoration: none;
}
.portal-logout:hover { background: rgba(255,255,255,.12); color: var(--header-text); text-decoration: none; }
.portal-shell {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}
.portal-sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--sidebar, #12241f);
    color: var(--sidebar-text, #f7f3ea);
    padding: 16px 12px 28px;
    position: sticky;
    top: 64px;
    align-self: flex-start;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.side-profile {
    text-align: center;
    padding: 6px 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 8px;
}
.side-photo {
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
    margin: 0 auto 10px;
    overflow: hidden;
    background: rgba(255,255,255,.12);
    border: 2px solid var(--accent);
    font-weight: 700;
}
.side-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-photo.shape-circle { border-radius: 50%; }
.side-photo.shape-square { border-radius: 4px; }
.side-photo.shape-rounded { border-radius: 16px; }
.side-profile strong { display: block; font-size: 14px; }
.side-profile span { display: block; font-size: 12px; opacity: .8; }
.side-photo-edit { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 12px; }
.portal-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
}
.portal-sidebar a:hover,
.portal-sidebar a.is-active { background: rgba(255,255,255,.1); }
.portal-sidebar .side-label {
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .65;
    padding: 12px 12px 6px;
}
.portal-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 20px 18px 40px;
    width: 100%;
}
.portal-main .container,
.portal-main .container-fluid { max-width: 100%; }
.portal-main table { max-width: 100%; }
.portal-main .table-responsive,
.portal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.portal-card {
    background: #fff;
    border: 1px solid #e4ddd2;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    max-width: 520px;
    margin: 24px auto;
}
.portal-card h1,
.portal-card h2 { margin: 0 0 8px; color: var(--heading, #0f3d3a); font-size: 22px; }
.portal-card p.lead { color: #5b6773; margin: 0 0 18px; }
.portal-card .form-control { height: 42px; border-radius: 8px; }
.portal-card .btn-primary,
.portal-btn {
    background: var(--header, #0f3d3a);
    border: 0;
    color: #fff;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
}
.portal-dash {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.portal-dash a {
    background: #fff;
    border: 1px solid #e4ddd2;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    min-height: 120px;
}
.portal-dash a:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgba(15,61,58,.08); }
.portal-dash i { font-size: 22px; color: var(--header); margin-bottom: 8px; display: block; }
.portal-dash h3 { margin: 0 0 6px; font-size: 15px; }
.portal-dash p { margin: 0; font-size: 12px; color: #64748b; }
.portal-stat { font-size: 26px; font-weight: 800; color: var(--header); }
.profile-hero {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}
.profile-hero .portal-avatar { width: 72px; height: 72px; flex-basis: 72px; font-size: 22px; }
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 720px) {
    .profile-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid .wide { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .portal-sidebar { display: none; }
    .portal-sidebar.is-open {
        display: block;
        position: fixed;
        inset: 64px 0 0 auto;
        width: min(280px, 86vw);
        z-index: 35;
        box-shadow: -8px 0 24px rgba(0,0,0,.2);
    }
    .portal-user-meta { display: none; }
}
body.school-portal footer.site-footer { margin-top: auto; }
.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; order: 3; }
.header-tools #portalLogout { margin: 0; }
body.school-portal .brand { order: 1; }
body.school-portal .site-nav { order: 2; flex: 1 1 auto; justify-content: flex-end; }
@media (max-width: 860px) {
    body.school-portal .header-tools { order: 2; }
    body.school-portal .site-nav { order: 3; }
}
.portal-page-title { margin: 0 0 16px; color: var(--heading, #0f3d3a); font-size: 26px; }
.portal-stats > div {
    background: #fff;
    border: 1px solid #e4ddd2;
    border-radius: 12px;
    padding: 16px;
}
.portal-stats i { font-size: 20px; color: var(--header); display: block; margin-bottom: 6px; }
.portal-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.portal-toolbar a, #enrolButtons a, #score-head a { margin: 0; }
#enrol-table-dropdown { width: 100%; }
#enrol-table-dropdown td { padding: 4px; }
@media (max-width: 720px) {
    #enrol-table-dropdown, #enrol-table-dropdown tbody, #enrol-table-dropdown tr, #enrol-table-dropdown td { display: block; width: 100%; }
    .welcome-container { flex-direction: column; text-align: center; }
    .details-column, .message-column { text-align: center !important; }
}
.portal-main html,
.portal-main body { display: contents; }
.student-dash .welcome-container { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.student-dash .tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.student-dash .tab-content { overflow-x: auto; }
