/* Reserve branding geometry before image decoding and avoid webfont-driven title shifts. */
body .crpd-live-header:not(.is-compact) .site-branding img:not(.crpd-compact-logo){display:block!important;width:56px!important;height:72px!important;max-height:72px!important;object-fit:contain}
body .crpd-live-header .site-branding picture,body .crpd-live-header .site-branding .custom-logo-link{flex-shrink:0}
body .crpd-live-header .site-title{font-family:"Segoe UI",Arial,sans-serif!important;white-space:nowrap;font-size:24px!important;line-height:1.2!important}
body .crpd-live-header.is-compact .site-title{font-size:18px!important}
@media(max-width:780px){
body.crpd-sidebar-page .crpd-live-header:not(.is-compact) .site-branding img:not(.crpd-compact-logo){width:38px!important;height:38px!important;max-height:38px!important}
body .crpd-live-header .site-title{font-size:16px!important}
}
/* Timetable context stays on one row on phones; label text remains accessible. */
@media(max-width:780px){
body .crpd-timetables .tt-period{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr) auto!important;align-items:center!important;gap:6px!important;width:100%;box-sizing:border-box}
body .crpd-timetables .tt-period label{display:flex!important;flex:1 1 0!important;min-width:0!important;gap:0!important;margin:0!important;font-size:0!important;line-height:0!important}
body .crpd-timetables .tt-period label:has(select[name="semester"]){flex:1.25 1 0!important}
body .crpd-timetables .tt-period label select,body .crpd-timetables .tt-period label select[name="semester"]{width:100%!important;min-width:0!important;max-width:100%!important;height:44px!important;min-height:44px!important;margin:0!important;padding:4px 22px 4px 6px!important;font-size:14px!important;line-height:1.3!important;box-sizing:border-box}
body .crpd-timetables .tt-period button{flex:0 0 auto!important;min-height:44px!important;margin:0!important;padding:4px 8px!important;font-size:12px!important}
}
/* Keep the theme's actual navigation, links, focus and mobile menu handlers. */
.crpd-live-header{--crpd-tools-height:36px}
.crpd-live-header.crpd-header-preparing::after{content:'';display:block;height:var(--crpd-tools-height);box-sizing:border-box;background:#f6f9fb;border-block:1px solid #e3eaf0}
body.crpd-sidebar-page .crpd-header-preparing::after{background:#dfeaf0;border-color:#c5d6e1}
.crpd-live-header>.crpd-header-tools-row{min-height:var(--crpd-tools-height);box-sizing:border-box}
@media(pointer:coarse){.crpd-live-header{--crpd-tools-height:50px}}
@media(max-width:780px){.crpd-live-header{--crpd-tools-height:50px}}
/* One compact row on phones; wrapping may grow naturally without clipping controls. */
@media(max-width:480px){.crpd-live-header{--crpd-tools-height:50px}}
/* Match the sidebar without recolouring the logo row or notification states. */
body.crpd-sidebar-page .crpd-live-header>.crpd-header-tools-row{background:#dfeaf0;border-top-color:#c5d6e1;border-bottom:1px solid #c5d6e1}
/* Reserve enough space for the complete semester and academic year, including the arrow. */
body .crpd-timetables .tt-period select[name="semester"]{width:240px!important;min-width:240px!important;box-sizing:border-box}
@media(max-width:600px){
body .crpd-timetables .tt-period select[name="semester"]{width:100%!important;min-width:0!important;max-width:100%!important}
}
/* Workspace header uses the same outer gutters as the sidebar, not theme max-width. */
body.crpd-sidebar-page .crpd-live-header{--crpd-header-gutter:24px}
body.crpd-sidebar-page .crpd-live-header .site-header-row-container-inner>.site-container,
body.crpd-sidebar-page .crpd-live-header>.crpd-header-tools-row>.crpd-header-tools{width:100%!important;max-width:none!important;box-sizing:border-box;margin-inline:0!important;padding-left:var(--crpd-header-gutter)!important;padding-right:var(--crpd-header-gutter)!important}
.crpd-live-header{z-index:9990;overflow:visible!important;background:#fff}
.crpd-live-header .site-header-row-container-inner{padding-top:0!important;padding-bottom:0!important}
.crpd-live-header .site-header-row{min-height:80px!important}
.crpd-live-header .site-branding{padding-top:4px!important;padding-bottom:4px!important;gap:12px}
.crpd-live-header:not(.is-compact) .site-branding img{max-height:72px!important;width:auto!important;object-fit:contain}
.crpd-live-header:not(.is-compact) .site-title{font-size:24px!important;line-height:1.2}
.crpd-live-header .site-branding img.crpd-compact-logo{display:none!important}
.crpd-live-header.is-compact .site-branding .crpd-full-logo{display:none!important}
.crpd-live-header.is-compact .site-branding img.crpd-compact-logo.is-ready{display:block!important;width:44px!important;height:43px!important;max-height:none!important;object-fit:contain}
.crpd-live-header.is-fixed{position:fixed!important;top:var(--crpd-admin-offset,0px)!important;left:0;right:0;width:100%;box-shadow:0 3px 14px #17344924;border-bottom:1px solid #d4e1e8}
.crpd-live-header-active.crpd-portal-dashboard-page .site-header .main-navigation{display:block!important}
.crpd-live-header-active.crpd-portal-dashboard-page .site-header .mobile-toggle-open-container{display:flex!important}
.crpd-live-header.is-compact .site-header-row-container-inner{padding-top:0!important;padding-bottom:0!important}
.crpd-live-header.is-compact .site-header-row{min-height:64px!important;max-height:none}
.crpd-live-header.is-compact .site-branding{padding-top:4px!important;padding-bottom:4px!important}
.crpd-live-header.is-compact .custom-logo,.crpd-live-header.is-compact .site-branding img{max-height:42px!important;width:auto!important;object-fit:contain}
.crpd-live-header.is-compact .site-title{font-size:18px!important;line-height:1.2}
.crpd-live-header.is-compact .site-description,.crpd-live-header.is-compact .crpd-active-year{display:none!important}
.crpd-live-header .crpd-header-menu-group{display:flex;flex-direction:column;align-items:flex-end;gap:0;min-width:0}
@media(min-width:1025px){.crpd-live-header.is-compact .crpd-header-menu-group{flex-direction:row-reverse;align-items:center;gap:14px}.crpd-live-header.is-compact .crpd-header-menu-group>.crpd-header-tools-row{width:auto}.crpd-live-header.is-compact .main-navigation .primary-menu-container>ul>li>a{padding-top:8px;padding-bottom:8px}}
.crpd-live-header .crpd-header-tools-row .crpd-header-tools{display:flex;flex-direction:column;align-items:flex-end;gap:1px;margin:0;padding:2px 12px;text-align:right}
@media(min-width:1200px){
 .crpd-live-header .crpd-header-menu-group{flex-direction:row-reverse;align-items:center;gap:16px}
 .crpd-live-header .crpd-header-menu-group>.crpd-header-tools-row{width:auto}
 .crpd-live-header .crpd-header-tools-row .crpd-header-tools{display:grid;grid-template-columns:auto auto;align-items:center;gap:0 8px;padding:3px 0 3px 12px;border-left:1px solid #e3eaf0}
 .crpd-live-header .crpd-live-notifications{grid-column:1/-1;justify-self:end}
 .crpd-live-header .crpd-active-year{font-size:10px;white-space:nowrap}
 .crpd-live-header .main-navigation .primary-menu-container>ul>li>a{padding:8px 10px}
 .crpd-live-header .crpd-live-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:0 6px}
 .crpd-live-header .crpd-live-status small{font-size:9px}
}
.crpd-live-header .crpd-inbox-bar{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin:0}
.crpd-live-header .crpd-inbox-bar.crpd-inbox-compact a{min-height:28px;padding:2px 5px;font-size:12px;border:0;background:transparent}
.crpd-live-notifications{display:flex;flex-direction:column;align-items:flex-end;gap:2px}
.crpd-live-status{font:11px/1.35 system-ui,sans-serif;color:#825400;text-align:right}
.crpd-live-status-line{display:flex;align-items:center;justify-content:flex-end;gap:4px}
.crpd-live-header .crpd-live-reload{display:inline-flex;align-items:center;justify-content:center;flex:none;width:28px;height:28px;min-height:28px;padding:0;margin:0;border:1px solid transparent;border-radius:5px;background:transparent;color:#526775;box-shadow:none;cursor:pointer;line-height:1}
.crpd-live-header .crpd-live-reload:hover{background:#e8f2f7;border-color:#bed2df;color:#075f87}
.crpd-live-header .crpd-live-reload:focus-visible{outline:2px solid #0879aa;outline-offset:2px}
.crpd-live-header .crpd-live-reload svg{display:block;width:15px;height:15px;pointer-events:none}
@media(pointer:coarse){.crpd-live-header .crpd-live-reload{width:44px;height:44px}}
.crpd-live-status [data-live-state]{display:inline-flex;align-items:center;gap:7px}
.crpd-live-status [data-live-state]::before{content:'';display:inline-block;flex:0 0 15px;width:15px;height:15px;border-radius:50%;background:currentColor;box-shadow:0 0 0 3px #ffffff,0 0 0 4px currentColor}
.crpd-live-status[data-state=online]{color:#166534}
.crpd-live-status[data-state=offline]{color:#a32323}
.crpd-live-status small{display:block;font-size:10px;color:#526775}
.crpd-header-tools.is-stale .crpd-inbox-count{outline:1px dashed #a66a00;outline-offset:2px}
.crpd-live-header .ops-widget.crpd-header-ops{position:static;right:auto;bottom:auto;z-index:auto}
.crpd-live-header .crpd-header-ops .ops-launch{min-height:28px;padding:2px 8px;font-size:12px;box-shadow:none;border:1px solid #b9c9dc;border-radius:7px;background:#ece7f8;color:#4b3473;gap:5px}
.crpd-live-header .crpd-header-ops .ops-launch.has-urgent{background:#fff0ed;color:#a32323;border-color:#d9a6a0}
.crpd-live-header .crpd-header-ops [data-ops-dot]{display:none}
.crpd-live-header .crpd-header-ops .ops-drawer{position:fixed;top:calc(var(--crpd-header-bottom,100px) + 4px);bottom:auto;right:12px;width:min(440px,calc(100vw - 24px));max-height:calc(100dvh - var(--crpd-header-bottom,100px) - 16px);text-align:left;z-index:9995}
/* Hide only redundant status displays. Save receipts and all error feedback remain visible. */
.crpd-live-header-active .crpd-absences .crpd-connection{display:none!important}
.crpd-live-header-active #ops-app>.ops-heading [data-ops-connection]{display:none!important}
.crpd-live-header-active .crpd-service-shortcuts{top:calc(var(--crpd-header-bottom,0px) + 6px)!important}
html{scroll-padding-top:calc(var(--crpd-header-bottom,0px) + 12px)}
@media(max-width:767px){
 .crpd-live-header .site-header-row{min-height:60px!important}
 .crpd-live-header:not(.is-compact) .site-branding img{max-height:52px!important}
 .crpd-live-header:not(.is-compact) .site-title{font-size:20px!important}
 .crpd-live-header.is-compact .site-title{font-size:15px!important}
 .crpd-live-header.is-compact .site-branding img{max-height:32px!important}
 .crpd-live-header.is-compact .site-header-row{min-height:44px!important}
 .crpd-live-header>.crpd-header-tools-row .crpd-header-tools{padding:3px 12px;border-top:1px solid #e3eaf0}
 .crpd-live-header .crpd-live-notifications{gap:1px}
 .crpd-live-header .crpd-inbox-bar.crpd-inbox-compact a,.crpd-live-header .crpd-header-ops .ops-launch{min-height:34px}
 .crpd-live-header:not(.is-compact) .crpd-active-year{font-size:11px}
}
@media(prefers-reduced-motion:reduce){.crpd-live-header *{scroll-behavior:auto}}
@media print{.crpd-live-header,.crpd-header-spacer{display:none!important}}
/* Two rows: untouched theme navigation above, compact notifications below. */
.crpd-live-header>.crpd-header-tools-row{border-top:1px solid #e3eaf0;background:#f7fafc}
.crpd-live-header>.crpd-header-tools-row>.crpd-header-tools{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 12px;max-width:var(--global-content-width,1280px);width:100%;box-sizing:border-box;margin:0 auto;padding:3px max(20px,var(--global-content-edge-padding,20px));border:0}
.crpd-live-header .crpd-live-notifications{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 12px}
.crpd-live-header .crpd-live-status{position:relative;display:block;font-size:11px}
.crpd-live-header .crpd-live-status small{display:none}
.crpd-live-header .crpd-live-status:hover small,.crpd-live-header .crpd-live-status.show-details small{display:block;position:absolute;right:0;top:100%;z-index:3;min-width:220px;padding:7px 10px;border:1px solid #c7d9e4;border-radius:6px;background:white;box-shadow:0 3px 10px #17344920}
/* Checking/offline details use the same popover as online: never add a second row. */
.crpd-live-header .crpd-live-detail-toggle{display:inline-flex;align-items:center;padding:5px;margin:0;min-height:30px;border:0;border-radius:5px;background:transparent;color:inherit;box-shadow:none;font:inherit;cursor:pointer}
.crpd-live-header .crpd-live-detail-toggle:focus-visible{outline:2px solid #0879aa;outline-offset:2px}
.crpd-live-header .main-navigation{margin-left:auto}
.crpd-dashboard-heading .crpd-active-year{margin:.35rem 0 0;font-size:.85rem;color:#526775}
.crpd-portal-dashboard.crpd-inbox-page{padding-top:0}
.crpd-inbox-page .crpd-inbox{margin-top:0;border-top:0;padding-top:0}
.crpd-inbox-page .crpd-inbox-titleband{position:relative;left:50%;width:100vw;margin-left:-50vw;margin-bottom:20px;padding:14px 20px;background:#edf2f6;text-align:center;box-sizing:border-box}
.crpd-inbox-page .crpd-inbox-titleband h1{margin:0;font-size:clamp(1.55rem,3vw,2rem);line-height:1.2}
@media(max-width:767px){.crpd-live-header>.crpd-header-tools-row>.crpd-header-tools{padding:4px 12px;gap:3px 10px}.crpd-live-header .crpd-live-notifications{gap:3px 10px}}
@media(pointer:coarse){.crpd-live-header .crpd-live-detail-toggle{min-height:44px}.crpd-live-status [data-live-state]::before{width:17px;height:17px;flex-basis:17px}}
/* A small height reduction only after scrolling; retain readable status and touch targets. */
.crpd-live-header.is-compact .site-header-row{min-height:52px!important}
.crpd-live-header.is-compact .site-branding{padding-top:2px!important;padding-bottom:2px!important}
.crpd-live-header.is-compact .site-branding img.crpd-compact-logo.is-ready{width:38px!important;height:37px!important}
.crpd-live-header.is-compact .main-navigation .primary-menu-container>ul>li>a{padding-top:5px;padding-bottom:5px}
.crpd-live-header.is-compact>.crpd-header-tools-row>.crpd-header-tools{padding-top:1px;padding-bottom:1px}
@media(max-width:767px){.crpd-live-header.is-compact .site-header-row{min-height:42px!important}.crpd-live-header.is-compact .site-branding img.crpd-compact-logo.is-ready{width:34px!important;height:33px!important}}
@media(pointer:coarse){.crpd-live-header.is-compact .main-navigation .primary-menu-container>ul>li>a{min-height:44px;box-sizing:border-box}}
/* Compact return to the service directory, integrated into the existing tab row. */
body .crpd-service-menu-link.crpd-service-menu-link{display:inline-flex;align-items:center;justify-content:center;align-self:stretch;flex:0 0 44px;min-width:44px;min-height:44px;padding:0;box-sizing:border-box;border:1px solid #aebdca;border-radius:999px;background:#fff;color:#075f87!important;text-decoration:none;line-height:1}
body .crpd-service-menu-link.crpd-service-menu-link:hover{background:#e7f4f9;border-color:#1682b3}
body .crpd-service-menu-link.crpd-service-menu-link:focus-visible{outline:3px solid #1682b3;outline-offset:2px}
body .crpd-service-menu-link svg{display:block;width:20px;height:20px;flex:none}
body .crpd-service-standalone-nav{display:flex;align-items:center;gap:8px;margin:16px 0 20px;padding:0;text-align:left}
/* Context filters precede the service tabs; table filters and registration fields are untouched. */
body .crpd-top-period-filter{display:flex!important;align-items:center!important;justify-content:center!important;flex-wrap:wrap;gap:5px 8px!important;margin:8px 0 12px!important;padding:0!important;font-size:12px!important;line-height:1.4}
body .crpd-top-period-filter[hidden]{display:none!important}
body.crpd-period-filter-page .crpd-top-period-filter{margin-top:4px!important;margin-bottom:22px!important}
body.crpd-period-filter-page.crpd-audicoes-dedicado .content-area{margin-top:6px!important}
/* A filter may be hidden by the shared academic-year selector. Its body marker
   must not reduce the space between the service heading and navigation. */
body.crpd-period-filter-page .crpd-top-period-filter+:is(.crpd-ga-user-tabs,.crpd-class-user-tabs,.crpd-registration-tabs,.crpd-audition-user-tabs,.crpd-rent-tabs,.mc-tabs,.crpd-absence-scopes){margin-top:0!important}
body .crpd-top-period-filter label{display:inline-flex!important;align-items:center;gap:5px;margin:0!important;font-size:12px!important;font-weight:400}
body .crpd-top-period-filter select{width:auto!important;min-width:125px;max-width:100%;height:32px!important;min-height:32px!important;padding:3px 26px 3px 8px!important;margin:0!important;border:1px solid #b9ccdb;border-radius:6px;font-size:12px!important;line-height:1.4;background-color:#fff}
body .crpd-top-period-filter button,body .crpd-top-period-filter input[type=submit]{width:auto!important;min-height:32px!important;padding:4px 10px!important;margin:0!important;border-radius:6px;font-size:12px!important;line-height:1.4}
@media(max-width:600px){body .crpd-top-period-filter{justify-content:flex-start!important}body .crpd-top-period-filter label{flex-wrap:wrap}}
@media(pointer:coarse){body .crpd-top-period-filter select,body .crpd-top-period-filter button,body .crpd-top-period-filter input[type=submit]{height:44px!important;min-height:44px!important}}
/* Compact service filters on phones. Labels remain in the accessibility tree. */
@media(max-width:600px){
body .crpd-top-period-filter{flex-wrap:nowrap!important;gap:6px!important;width:100%;max-width:100%;box-sizing:border-box}
body .crpd-top-period-filter label{flex:1 1 0;min-width:0;gap:0;flex-wrap:nowrap!important;font-size:0!important;line-height:0}
body .crpd-top-period-filter label:first-of-type{flex:0 1 112px}
body .crpd-top-period-filter select{width:100%!important;min-width:0!important;max-width:100%!important;height:44px!important;min-height:44px!important;padding:4px 22px 4px 6px!important;font-size:16px!important;line-height:1.2;text-overflow:ellipsis}
body .crpd-top-period-filter button,body .crpd-top-period-filter input[type=submit]{flex:0 0 auto;height:44px!important;min-height:44px!important;padding:4px 7px!important;font-size:12px!important;white-space:nowrap}
}
/* Compact phones; preserve original links, accessible text and touch target height. */
@media(max-width:780px){
body.crpd-sidebar-page .crpd-live-header{--crpd-header-gutter:10px}
body.crpd-sidebar-page .crpd-live-header .site-header-row{min-height:48px!important}
body.crpd-sidebar-page .crpd-live-header .site-branding{gap:7px;padding-block:3px!important;min-width:0}
body.crpd-sidebar-page .crpd-live-header:not(.is-compact) .site-branding img{max-height:38px!important;width:auto!important}
body.crpd-sidebar-page .crpd-live-header .site-title{font-size:16px!important;line-height:1.2!important}
body.crpd-sidebar-page .crpd-live-header .site-description{display:none!important}
body.crpd-sidebar-page .crpd-live-header>.crpd-header-tools-row>.crpd-header-tools{gap:2px 6px;padding-block:1px!important}
body.crpd-sidebar-page .crpd-live-header .crpd-live-notifications{gap:2px 6px;min-width:0;max-width:100%}
body.crpd-sidebar-page .crpd-live-header .crpd-inbox-bar{gap:2px}
body.crpd-sidebar-page .crpd-live-header .crpd-inbox-bar.crpd-inbox-compact a{font-size:0;gap:4px;min-width:44px;min-height:44px;padding:4px}
body.crpd-sidebar-page .crpd-live-header .crpd-inbox-bar a>span:first-child{font-size:16px}
body.crpd-sidebar-page .crpd-live-header .crpd-inbox-count{font-size:11px;line-height:1.3}
body.crpd-sidebar-page .crpd-live-header .crpd-header-ops .ops-launch{font-size:0;min-height:44px;min-width:44px;padding:4px 6px;gap:4px}
body.crpd-sidebar-page .crpd-live-header .crpd-header-ops .ops-launch::before{content:'🔔';font-size:16px;line-height:1}
body.crpd-sidebar-page .crpd-live-header .crpd-header-ops [data-ops-count]{font-size:11px}
body.crpd-sidebar-page .crpd-live-header .crpd-live-status{font-size:10px}
body.crpd-sidebar-page .crpd-live-header .crpd-live-detail-toggle,
body.crpd-sidebar-page .crpd-live-header .crpd-live-reload{min-height:44px}
body.crpd-sidebar-page .crpd-live-header .crpd-live-reload{width:44px}
body.crpd-sidebar-page .crpd-live-header .crpd-live-status [data-live-state]::before{width:10px;height:10px;flex-basis:10px}
}
/* Compact status: natural text width, followed by the connection indicator and reload. */
.crpd-live-header .crpd-live-status [data-live-state]{position:relative;display:block;width:auto;box-sizing:border-box;padding:4px 28px 4px 0;white-space:nowrap;text-align:right}
.crpd-live-header .crpd-live-status [data-live-state]::before{position:absolute;right:4px;left:auto;top:50%;transform:translateY(-50%)}
.crpd-live-header .crpd-inbox-count,.crpd-live-header [data-ops-count]{min-width:2ch;text-align:center;font-variant-numeric:tabular-nums}
@media(max-width:780px){.crpd-live-header .crpd-live-status [data-live-state]{padding-left:0;padding-right:24px}}
/* Login, password recovery and error pages keep a full-size header in normal flow.
   The head marker is applied before the header is parsed, preventing a fixed flash. */
html.crpd-static-header-page header.site-header,
html.crpd-static-header-page #masthead.site-header,
.crpd-live-header.crpd-header-static {
  position:relative!important;top:auto!important;left:auto!important;right:auto!important;
  transform:none!important;width:100%;
}
html.crpd-static-header-page .crpd-header-spacer { display:none!important;height:0!important; }
html.crpd-static-header-page .crpd-header-tools-row,
html.crpd-static-header-page .crpd-live-notifications { display:none!important; }
body .crpd-service-current-page{display:inline-flex;align-items:center;justify-content:center;min-height:44px;box-sizing:border-box;padding:10px 14px;border:1px solid #1682b3;border-radius:24px;background:#1682b3;color:#fff;font-family:inherit;font-size:16px;font-weight:700;line-height:1.4;text-align:center}
