/* Clock and return controls live inside the existing header, beside global search. */
:root{--cm-common-height:0px}
.cm-portal-common{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;flex:0 0 auto;min-width:146px;margin:0 0 0 auto;padding:3px 8px;color:#294467;font:12px/1.3 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.cm-common-context{display:none}.cm-common-clock{display:flex;align-items:baseline;justify-content:center;gap:7px;white-space:nowrap}.cm-common-time{font:700 15px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;font-variant-numeric:tabular-nums;letter-spacing:.02em}.cm-common-date{font-size:10px;white-space:nowrap}
.cm-common-nav{display:flex;align-items:center;justify-content:center;gap:7px}.cm-portal-common .cm-common-nav :is(button,a){box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:30px;min-width:30px;height:28px;min-height:28px;margin:0;padding:5px;border:1px solid #bccde1;border-radius:8px;background:#f4f8fd;color:inherit;text-decoration:none;cursor:pointer;box-shadow:0 1px 2px #142a4610}.cm-common-nav svg{display:block;width:17px;height:17px;flex:none}.cm-portal-common .cm-common-nav :is(button,a):hover{background:#e2edfb;border-color:#7696bf}.cm-portal-common .cm-common-nav :is(button,a):focus-visible{outline:3px solid #3478d5;outline-offset:2px}
.cm-shell-header .cm-portal-common{color:#edf5ff;padding-inline:0;min-width:225px;margin:0}.cm-shell-header .cm-common-date{color:#cad8eb}.cm-shell-header .cm-common-nav :is(button,a){background:#29415d;border-color:#607995;color:#edf5ff}.cm-shell-header .cm-common-nav :is(button,a):hover{background:#385676}.cm-shell-header .cm-common-nav :is(button,a):focus-visible{outline-color:#ffd27c}
body.cm-common-ready [data-portal-clock],body.cm-common-ready .lg-clock{display:none!important}
/* Remove the old strip's offsets. Existing shell heights remain authoritative. */
body.cm-common-ready.cm-shell>.cm-shell-header{top:0}body.cm-common-ready.cm-shell>.sidebar{top:var(--shell-height)}body.cm-common-ready.cm-shell .topbar{top:var(--shell-height)}body.cm-common-ready .study-sidebar{top:0;height:100dvh;bottom:auto}body.cm-common-ready :is(.study-app>.topbar,.app-shell>main>header,#magnus-main>.topbar,.guide-shell>main>header){top:0}body.cm-common-ready :is(.app-shell>aside,.magnus-sidebar,.guide-shell>aside){top:0;height:100dvh}body.cm-common-ready .magnus-shell .workspace{top:0}
.cm-common-standalone{position:relative;align-self:flex-end;min-width:0;margin:8px 16px 0;padding:6px 8px;background:transparent}
body[data-theme=dark] .cm-portal-common{color:#e1edff}body[data-theme=dark] .cm-common-nav :is(button,a){background:#293d57;border-color:#637b99}.high-contrast .cm-common-nav :is(button,a){border:2px solid currentColor}
@media(max-width:1100px){.cm-shell-bar{gap:12px}.cm-shell-header .cm-portal-common{min-width:170px}.cm-shell-header .cm-common-clock{gap:2px;flex-direction:column;align-items:center}.cm-shell-header .cm-common-time{font-size:13px}.cm-shell-header .cm-common-date{font-size:9px}.cm-shell-header .cm-common-nav :is(button,a){height:24px;min-height:24px;padding:3px}}
@media(max-width:760px){body.cm-common-ready.cm-shell{--shell-height:126px}.cm-shell-header .cm-shell-bar{height:80px;gap:8px}.cm-shell-header .cm-portal-common{min-width:116px}.cm-shell-header .cm-shell-quick{display:none}.cm-shell-header .cm-shell-brand{flex-basis:80px}.cm-shell-header .cm-shell-brand img{width:80px!important}.cm-shell-header .cm-common-time{font-size:14px}.cm-shell-header .cm-common-date{font-size:8px}.cm-shell-header .cm-shell-search{padding:8px;min-width:65px}.cm-portal-common{min-width:115px;padding-inline:3px}.cm-common-clock{flex-direction:column;align-items:center;gap:0}.cm-common-time{font-size:13px}.cm-common-date{font-size:8px}.cm-portal-common .cm-common-nav :is(button,a){width:32px;min-width:32px;height:30px;min-height:30px}.study-app>.topbar{flex-wrap:wrap;height:auto;min-height:84px;gap:8px}.study-app>.topbar>.top-actions{margin-left:auto}.study-app>.topbar>.cm-portal-common{margin-left:auto}.study-app>.topbar>#menu{flex:none}}
@media(pointer:coarse){.cm-portal-common .cm-common-nav :is(button,a){width:36px;min-width:36px;height:32px;min-height:32px}}
@media print{.cm-portal-common{display:none!important}}
@media(max-width:760px){body.cm-common-ready :is(.app-shell>main>header,#magnus-main>.topbar,.guide-shell>main>header,.lg-top){flex-wrap:wrap;height:auto;min-height:80px;gap:8px}body.cm-common-ready :is(.header-actions,.top-actions){flex-wrap:wrap;gap:6px}.lg-top>.cm-portal-common{margin-left:auto}}
/* Module headers style every direct div/span; keep the embedded widget isolated. */
#cm-portal-common{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;line-height:1.3;border:0;box-shadow:none}
#cm-portal-common .cm-common-context{display:none!important}
#cm-portal-common .cm-common-clock{display:flex;flex-direction:row;align-items:baseline;gap:7px;margin:0;padding:0;border:0;background:transparent}
#cm-portal-common .cm-common-date{display:inline;margin:0;padding:0;border:0}
#cm-portal-common .cm-common-nav{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:7px;margin:0;padding:0;border:0;background:transparent}
body.cm-common-ready .study-app>.topbar>.top-actions{margin-left:auto;margin-right:16px}
@media(max-width:1100px){.cm-shell-header #cm-portal-common .cm-common-clock{flex-direction:column;align-items:center;gap:2px}}
@media(max-width:760px){#cm-portal-common .cm-common-clock{flex-direction:column;align-items:center;gap:0}body.cm-common-ready .study-app>.topbar>.top-actions{margin-right:0}}

/* Portal controls audit · 2026-10-26. Scope navigation and action rows, never document canvases. */
:root{--cm-control-radius:8px;--cm-control-height:40px;--cm-menu-height:44px}
body.cm-shell .sidebar nav>:is(a,button){box-sizing:border-box;display:flex;align-items:center;justify-content:flex-start;gap:10px!important;width:100%;min-width:0;min-height:var(--cm-menu-height);margin:0;padding:6px 8px!important;border:0;border-radius:7px!important;background:transparent;color:var(--muted,#596575)!important;font-family:inherit;font-size:12px;font-weight:500;line-height:1.35;text-decoration:none;text-align:left;cursor:pointer}
body.cm-shell .sidebar nav>a{font-family:inherit;font-size:12px;font-weight:500;line-height:1.35}
body.cm-shell .sidebar nav>:is(a,button)>:is(img,svg),body.cm-shell .sidebar .module-icon-slot{width:26px!important;height:26px!important;min-width:26px;max-width:26px;flex:0 0 26px;object-fit:contain}
body.cm-shell .sidebar nav>:is(a,button)>span:not(.module-icon-slot){min-width:0;overflow-wrap:anywhere}
body.cm-shell .sidebar nav>:is(a,button):hover{background:var(--soft,#e8f0f8);color:var(--blue,#3973b8)!important}
body.cm-shell .sidebar nav>:is(a,button):is(.active,[aria-current=page]){background:var(--soft,#e8f0f8);color:var(--blue,#3973b8)!important;font-weight:600}
:is(.study-sidebar,.magnus-sidebar,.guide-shell>aside,.app-shell>aside) nav>:is(a,button){box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:var(--cm-menu-height);width:100%;padding:8px 12px;border-radius:var(--cm-control-radius);font-family:inherit;font-size:13px;line-height:1.35;text-align:left;text-decoration:none}
.study-sidebar nav .study-nav-icon{width:26px;height:26px;flex:0 0 26px}
:is(.sidebar,.study-sidebar,.magnus-sidebar,.app-shell>aside,.guide-shell>aside) nav>:is(a,button):focus-visible{outline:3px solid var(--blue,#3973b8);outline-offset:2px}
:is(.study-app>.topbar .top-actions,.app-shell>main>header .header-actions,.guide-shell>main>header .header-actions,.lg-top,.binder-toolbar) :is(button,a:not(.brand)){min-height:var(--cm-control-height);border-radius:var(--cm-control-radius)}
:is(.study-app,.app-shell,.cm-shell,.guide-shell) button:disabled{cursor:not-allowed}
:is(.study-app,.app-shell,.cm-shell,.guide-shell) [aria-busy=true] button:disabled{cursor:progress}
.study-app #content{scroll-margin-top:96px}
@media(pointer:coarse),(max-width:760px){:is(.sidebar,.study-sidebar,.magnus-sidebar,.app-shell>aside,.guide-shell>aside) nav>:is(a,button){min-height:44px}:is(.cm-common-nav,.header-actions,.top-actions,.lg-top,.binder-toolbar) :is(button,a:not(.brand)){min-height:44px;min-width:44px}#cm-portal-common .cm-common-nav :is(button,a){min-width:44px;width:44px;min-height:44px;height:44px;padding:8px}.cm-shell-header #cm-portal-common{min-width:116px}}
@media(prefers-reduced-motion:reduce){:is(.sidebar,.study-sidebar,.magnus-sidebar,.app-shell>aside,.guide-shell>aside) nav>:is(a,button){transition:none}}
