/* Shared portal navigation, independent of each page's feature styles. */
body .portal-section-nav,body .teaching-nav{display:flex!important;flex-wrap:wrap;gap:6px!important;align-items:center;background:#fff!important;border:1px solid #e1e6ec!important;border-radius:12px!important;padding:6px!important;margin:24px 0 30px!important;width:fit-content;max-width:100%;box-sizing:border-box;box-shadow:none!important}
body .portal-section-nav a,body .teaching-nav a{display:block!important;flex:0 0 auto!important;min-height:44px!important;box-sizing:border-box;padding:11px 18px!important;border:0!important;border-radius:7px!important;background:transparent!important;color:#536174!important;font:600 15px/22px Arial,sans-serif!important;box-shadow:none!important;text-decoration:none!important;white-space:nowrap}
body .portal-section-nav a:hover,body .teaching-nav a:hover{background:#f2f5f8!important;color:#0D2E6E!important}body .portal-section-nav a[aria-current=page],body .teaching-nav a[aria-current=page]{background:#edf1f5!important;color:#0D2E6E!important;box-shadow:inset 0 -3px #D7A622!important}.portal-nav-icon{display:none!important}body .portal-section-nav a:focus-visible,body .teaching-nav a:focus-visible{outline:3px solid #D7A622!important;outline-offset:2px}
body[data-navigation-role=teacher] .auth-top{display:flex!important;align-items:center!important;gap:18px!important;border-bottom:1px solid #e1e6ec!important;padding:0 0 20px!important;margin-bottom:0!important;flex-wrap:wrap}
body[data-navigation-role=teacher] .auth-top .auth-logo{margin-right:auto!important}body[data-navigation-role=teacher] .auth-logo img{height:72px!important;width:auto!important;max-width:140px!important}.teacher-shared-utilities{display:flex;align-items:center;gap:22px;order:1}.teacher-shared-utilities a{color:#0D2E6E;text-decoration:none;font:600 14px Arial,sans-serif;min-height:44px;display:inline-flex;align-items:center}.teacher-shared-utilities a[aria-current=page]{text-decoration:underline;text-underline-offset:7px}
body[data-navigation-role=teacher] .auth-top #logout{order:2;font:600 14px Arial,sans-serif!important;min-height:44px!important;padding:10px 16px!important;background:white!important;border:1px solid #dce2e8!important;color:#0D2E6E!important;border-radius:7px!important;width:auto!important;margin:0!important}
body[data-navigation-role=teacher] .student-dashboard-back,body[data-navigation-role=teacher] main>.portal-section-nav+a[data-staff-dashboard]{display:none!important}
@media(max-width:700px){body .portal-section-nav,body .teaching-nav{flex-wrap:nowrap!important;overflow-x:auto!important;width:100%;gap:2px!important;border-radius:8px!important;margin:18px 0 24px!important;scrollbar-width:thin}body .portal-section-nav a,body .teaching-nav a{font-size:14px!important;padding:11px 12px!important}body[data-navigation-role=teacher] .auth-logo img{height:56px!important}.teacher-shared-utilities{gap:14px}body[data-navigation-role=teacher] .auth-top{gap:10px!important}}
body[data-navigation-role=teacher] main{max-width:1240px!important;box-sizing:border-box;margin-left:auto!important;margin-right:auto!important}body[data-navigation-role=teacher] .teacher-shared-utilities .teacher-manage{position:relative;font:600 14px Arial,sans-serif}.teacher-shared-utilities .teacher-manage summary{list-style:none;cursor:pointer;padding:12px 4px;min-height:44px;box-sizing:border-box}.teacher-shared-utilities .teacher-manage summary::after{content:' ▾'}.teacher-shared-utilities .teacher-manage>div{position:absolute;right:0;top:42px;z-index:50;background:white;border:1px solid #dce2e8;border-radius:10px;box-shadow:0 12px 32px #0D2E6E18;padding:8px;min-width:230px}.teacher-shared-utilities .teacher-manage>div a{display:flex;padding:10px 12px;font-weight:500;min-height:40px;border-radius:6px}.teacher-shared-utilities .teacher-manage>div a:hover{background:#f1f4f7}.teacher-shared-utilities a:focus-visible,.teacher-shared-utilities summary:focus-visible{outline:3px solid #D7A622;outline-offset:3px}
/* Legacy global nav rules must never float this page navigation over content. */
body .portal-section-nav,body .teaching-nav{position:static!important;inset:auto!important;transform:none!important;z-index:auto!important;height:auto!important;float:none!important}

/* Portal controls must fit their panels before longer labels wrap. */
@media screen{
 body[data-navigation-role] :is(.auth-top,.portal-section-nav,.teaching-nav){box-sizing:border-box;min-width:0;max-width:100%}
 body[data-navigation-role] :is(.assigned-work-filters,.marking-filters,.register-controls,.finance-payment-form,.lesson-picker)>*{min-width:0}
 body[data-navigation-role] :is(.assigned-work-filters,.marking-filters,.register-controls,.finance-payment-form,.lesson-picker) :is(input,select){box-sizing:border-box;min-width:0;max-width:100%;font-size:16px}
}
@media screen and (max-width:1000px){
 body .portal-section-nav,body .teaching-nav{width:100%;flex-wrap:wrap!important}
 body .portal-section-nav a,body .teaching-nav a{flex:1 1 auto!important;text-align:center}
 body[data-navigation-role] :is(.assigned-work-filters,.marking-filters){grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media screen and (max-width:600px){
 body .portal-section-nav,body .teaching-nav{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible!important}
 body .portal-section-nav a,body .teaching-nav a{min-width:0;white-space:normal!important;padding:10px 8px!important;line-height:1.45!important}
 body .portal-section-nav a:last-child:nth-child(odd){grid-column:1/-1}
 body[data-navigation-role] :is(.assigned-work-filters,.marking-filters,.register-controls,.finance-payment-form,.lesson-picker){grid-template-columns:minmax(0,1fr)}
 body[data-navigation-role=teacher] .auth-top{column-gap:12px!important;row-gap:4px!important}
 body[data-navigation-role=teacher] .auth-top .auth-logo{flex:1 1 100%!important;margin:0!important}
 body[data-navigation-role=teacher] .auth-top .teacher-shared-utilities{margin-right:auto}
 body[data-navigation-role=teacher] .teacher-manage>div{right:auto;left:0;min-width:200px;max-width:calc(100vw - 32px)}
}
/* One compact mobile menu; desktop keeps its horizontal navigation. */
.portal-mobile-menu,.portal-mobile-location{display:none}
body .teacher-header-actions{display:flex;align-items:center;gap:16px}
body .teacher-header-actions :is(.teacher-marking-shortcut,.teacher-manage>summary){display:inline-flex;align-items:center;min-height:44px;margin:0;box-sizing:border-box;font:600 14px/1.4 Arial,sans-serif}
.teacher-welcome>#teaching-refresh{align-self:flex-start;margin:0}
@media screen and (max-width:700px){
 body.has-mobile-portal-menu .auth-top{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;align-items:center!important;justify-content:space-between!important;gap:16px!important;padding:0 0 16px!important;margin-bottom:0!important}
 body.has-mobile-portal-menu .auth-top .auth-logo{flex:0 1 auto!important;margin:0!important}
 body.has-mobile-portal-menu .auth-logo img{height:56px!important;max-width:120px!important;object-fit:contain}
 body.has-mobile-portal-menu .portal-mobile-menu{display:block;position:relative;flex:none;order:3;color:#0D2E6E;font:16px/1.5 Arial,sans-serif}
 .portal-mobile-menu>summary{display:flex;align-items:center;justify-content:center;list-style:none;cursor:pointer;min-height:44px;padding:8px 18px;background:#fff;border:1px solid #bcc8d3;border-radius:8px;font-weight:700}
 .portal-mobile-menu>summary::-webkit-details-marker{display:none}
 .portal-mobile-menu>summary::after{content:'⌄';margin-left:10px}
 .portal-mobile-menu[open]>summary{background:#edf1f5;border-color:#0D2E6E}
 .portal-mobile-menu>summary:focus-visible{outline:3px solid #D7A622;outline-offset:3px}
 body.has-mobile-portal-menu .portal-mobile-location{display:block;font:600 14px/1.5 Arial,sans-serif;color:#637184;margin:12px 0 20px}
 .portal-mobile-panel{position:absolute;right:0;top:calc(100% + 10px);z-index:100;width:min(320px,calc(100vw - 48px));max-height:calc(100dvh - 180px);overflow-y:auto;box-sizing:border-box;padding:10px;background:white;border:1px solid #dce2e8;border-radius:12px;box-shadow:0 12px 32px #0D2E6E26}
 body.has-mobile-portal-menu .portal-mobile-panel :is(.teaching-nav,.portal-section-nav){display:flex!important;flex-direction:column;align-items:stretch!important;gap:2px!important;border:0!important;padding:0!important;margin:0!important;width:100%;overflow:visible!important}
 body.has-mobile-portal-menu .portal-mobile-panel :is(.teaching-nav,.portal-section-nav) a{text-align:left!important;flex:none!important;padding:12px 14px!important;white-space:normal!important}
 body.has-mobile-portal-menu .portal-mobile-panel :is(.teacher-header-actions,.teacher-shared-utilities){display:flex!important;flex-direction:column;align-items:stretch!important;gap:2px!important;border-top:1px solid #e1e6ec;padding-top:8px;margin:8px 0 0!important}
 body.has-mobile-portal-menu .portal-mobile-panel :is(.teacher-marking-shortcut,.teacher-shared-utilities>a,.teacher-manage>summary){display:flex!important;align-items:center;gap:6px;min-height:44px;padding:12px 14px!important;color:#0D2E6E;text-decoration:none;font:600 15px/1.4 Arial,sans-serif!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-manage>div{position:static!important;min-width:0!important;max-width:100%;padding:0 0 8px 12px;border:0;box-shadow:none}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-manage>div a{display:flex;align-items:center;min-height:44px;padding:10px 14px;font-size:14px!important}
 body.has-mobile-portal-menu .portal-mobile-panel #logout{width:100%!important;margin:8px 0 0!important;order:2}
 body.has-mobile-portal-menu .teacher-welcome{display:flex;align-items:flex-start;gap:16px;margin-top:20px}
 body.has-mobile-portal-menu .teacher-welcome>div{flex:1;min-width:0}
 body.has-mobile-portal-menu #teaching-refresh{flex:none;font-size:14px;padding:8px 12px;min-height:44px}
}

/* Feature pages style all details elements; isolate the shared header menus. */
body.has-mobile-portal-menu .auth-top .portal-mobile-menu{padding:0!important;margin:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;width:auto!important;min-width:0!important;max-width:none!important}
body.has-mobile-portal-menu .auth-top .teacher-manage{padding:0!important;margin:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;min-width:0!important;width:auto!important}
body.has-mobile-portal-menu .auth-top .teacher-manage>summary{white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;width:auto!important}
@media screen and (max-width:700px){
 body.has-mobile-portal-menu .auth-top .portal-mobile-menu>summary{width:auto!important;min-width:96px;white-space:nowrap;word-break:normal;overflow-wrap:normal;margin:0!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-header-actions>.back{display:none!important}
 body.has-mobile-portal-menu .portal-mobile-panel :is(.teacher-header-actions,.teacher-shared-utilities){width:100%!important;min-width:0!important;align-items:stretch!important;flex-wrap:nowrap!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-manage>summary{justify-content:flex-start!important;text-align:left!important}
}

/* Keep teacher workspace links readable and fully in view in the phone menu. */
@media screen and (max-width:700px){
 body.has-mobile-portal-menu .auth-top{width:100%;justify-content:flex-end!important;position:relative}
 body.has-mobile-portal-menu .auth-top .portal-mobile-menu{margin-left:auto!important}
 body.has-mobile-portal-menu .portal-mobile-panel{left:auto;right:0;width:min(320px,calc(100vw - 32px));max-width:calc(100vw - 32px)}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-account-nav{display:flex!important;flex-direction:column;align-items:stretch!important;gap:2px!important;width:100%;margin:8px 0 0!important;padding:8px 0 0!important;border:0!important;border-top:1px solid #e1e6ec!important;border-radius:0!important;background:#fff!important;overflow:visible!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-account-nav a{display:flex!important;align-items:center;min-height:44px;padding:12px 14px!important;border:0!important;border-radius:7px!important;background:#fff!important;color:#33445d!important;box-shadow:none!important;text-align:left!important;font:600 15px/1.4 Arial,sans-serif!important;text-decoration:none!important;white-space:normal!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-account-nav a:hover{background:#f1f4f8!important;color:#0D2E6E!important}
 body.has-mobile-portal-menu .portal-mobile-panel .teacher-account-nav a:focus-visible{outline:3px solid #D7A622!important;outline-offset:2px}
 body.has-mobile-portal-menu .portal-mobile-panel .teaching-nav a[aria-current="page"]{background:#f6edcc!important;color:#173967!important;box-shadow:inset 3px 0 #D7A622!important}
}
