/* QuPID shared service chrome. Calendar / TeX / Workspace use this exact header. */
:root{--qsh-h:4.25rem;--qsh-bg:#fff;--qsh-line:#e2e4e9;--qsh-text:#1c2230;--qsh-muted:#687285;--qsh-control:#f6f7f9;--qsh-control-hover:#eef1f5;--qsh-accent:#8b5cf6;--qsh-accent-soft:#eee8ff;--qsh-accent-text:#6d46c7;--qsh-focus:0 0 0 3px rgba(139,92,246,.16)}
body[data-service="calendar"]{--qsh-accent:#9b7bea;--qsh-accent-soft:#efeaff;--qsh-accent-text:#6f52bd;--qsh-focus:0 0 0 3px rgba(155,123,234,.2)}
body[data-service="tex"]{--qsh-accent:#d85b9c;--qsh-accent-soft:#fae8f2;--qsh-accent-text:#a13d73;--qsh-focus:0 0 0 3px rgba(216,91,156,.2)}
body[data-service="workspace"]{--qsh-accent:#46a9dc;--qsh-accent-soft:#e6f5fc;--qsh-accent-text:#1879a8;--qsh-focus:0 0 0 3px rgba(70,169,220,.2)}
html[data-theme="dark"]{--qsh-bg:#171c24;--qsh-line:#303846;--qsh-text:#f4f6f8;--qsh-muted:#aeb7c5;--qsh-control:#1e2630;--qsh-control-hover:#273240}
html[data-theme="dark"] body[data-service="calendar"]{--qsh-accent-soft:#362c56;--qsh-accent-text:#c4afff}
html[data-theme="dark"] body[data-service="tex"]{--qsh-accent-soft:#4c3041;--qsh-accent-text:#f18abc}
html[data-theme="dark"] body[data-service="workspace"]{--qsh-accent-soft:#173f54;--qsh-accent-text:#79c8ee}
html[data-theme="light"]{--qsh-bg:#fff;--qsh-line:#e2e4e9;--qsh-text:#1c2230;--qsh-muted:#687285;--qsh-control:#f6f7f9;--qsh-control-hover:#eef1f5}

.qupid-service-header{box-sizing:border-box;position:fixed;top:var(--qupid-safe-top,0px);left:0;right:0;z-index:180;display:grid!important;grid-template-columns:minmax(12rem,1fr) minmax(18rem,34rem) minmax(12rem,1fr);align-items:center;min-height:var(--qsh-h)!important;height:var(--qsh-h);padding:0 max(1rem,var(--qupid-safe-right,0px)) 0 max(1rem,var(--qupid-safe-left,0px));border-bottom:1px solid var(--qsh-line)!important;background:var(--qsh-bg)!important;color:var(--qsh-text)!important;gap:1rem}

/* The shared service chrome is viewport-fixed. Keep document content in normal
   flow below it and prevent pull/overscroll from visually dragging the app chrome. */
.qupid-service-header + .app-shell,.qupid-service-header + .auth-content{margin-top:var(--qsh-h)}
.qupid-service-header + .tex-library-shell,.qupid-service-header + .tex-system-shell{margin-top:calc(var(--qsh-h) + 1.5rem)}
.app-shell [id],.auth-content [id],.tex-library-shell [id],.tex-system-shell [id]{scroll-margin-top:calc(var(--qsh-h) + var(--qupid-safe-top,0px) + .75rem)}
html,body{overscroll-behavior-y:none}
.qupid-service-header-start,.qupid-service-header-end{display:flex;min-width:0;align-items:center}
.qupid-service-header-start{justify-self:start;gap:.35rem}.qupid-service-header-center{width:100%;min-width:0}.qupid-service-header-end{justify-self:end;justify-content:flex-end;gap:.8rem;font-size:.875rem;white-space:nowrap}
.qupid-service-brand{display:grid!important;width:2.75rem;height:2.75rem;place-items:center;flex:0 0 auto}.qupid-service-brand img{display:block!important;width:2.65rem!important;height:2.65rem!important;object-fit:contain}
.qupid-service-header .service-switcher{display:flex!important;align-items:center;gap:.12rem;margin:0!important;padding:.12rem!important;border:0!important;background:transparent!important}
.qupid-service-header .service-switcher a{display:grid!important;width:2.25rem!important;height:2.25rem!important;min-height:2.25rem!important;place-items:center;padding:0!important;border:0!important;border-radius:.5rem!important;background:transparent!important;color:var(--qsh-muted)!important;text-decoration:none}
.qupid-service-header .service-switcher a:hover{background:var(--qsh-control-hover)!important;color:var(--qsh-text)!important}.qupid-service-header .service-switcher a.active{background:var(--qsh-accent-soft)!important;color:var(--qsh-accent-text)!important}
.qupid-service-header .service-switcher a svg{width:1.12rem!important;height:1.12rem!important;fill:none!important;stroke:currentColor!important;stroke-width:1.8!important;stroke-linecap:round;stroke-linejoin:round}
.qupid-service-header .sr-only,.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

.qupid-service-header .workspace-top-search,.qupid-global-search{box-sizing:border-box;display:flex!important;width:100%;max-width:34rem!important;height:2.35rem!important;margin:0 auto!important;align-items:center;gap:.5rem;padding:0 .72rem!important;border:1px solid var(--qsh-line)!important;border-radius:.55rem!important;background:var(--qsh-control)!important;color:var(--qsh-muted)!important;box-shadow:none!important}
.qupid-service-header .workspace-top-search:focus-within{border-color:var(--qsh-accent)!important;box-shadow:none!important;outline:2px solid var(--qsh-accent);outline-offset:-1px}.qupid-service-header .workspace-top-search svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.8;flex:0 0 auto}.qupid-service-header .workspace-top-search input{width:100%;min-width:0;border:0!important;outline:0;background:transparent!important;color:var(--qsh-text)!important;font:inherit;font-size:.84rem}.qupid-service-header .workspace-top-search input::placeholder{color:var(--qsh-muted)!important}

.qupid-service-header .service-theme-control{position:relative;display:inline-flex;align-items:center}.qupid-service-header .service-settings-button{display:grid!important;width:2.25rem!important;height:2.25rem!important;min-width:2.25rem;place-items:center;padding:0!important;border:1px solid var(--qsh-line)!important;border-radius:.5rem!important;background:transparent!important;color:var(--qsh-muted)!important}.qupid-service-header .service-settings-button:hover,.qupid-service-header .service-settings-button[aria-expanded="true"]{background:var(--qsh-control-hover)!important;color:var(--qsh-text)!important}.qupid-service-header .service-settings-button svg{width:1.05rem;height:1.05rem;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.qupid-service-header .service-theme-menu{position:absolute;z-index:220;top:calc(100% + .45rem);right:0;width:9.5rem;padding:.35rem;border:1px solid var(--qsh-line);border-radius:.6rem;background:var(--qsh-bg);color:var(--qsh-text);box-shadow:none}.qupid-service-header .service-theme-menu[hidden]{display:none!important}.qupid-service-header .service-theme-title{padding:.35rem .5rem;color:var(--qsh-muted);font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em}.qupid-service-header .service-theme-menu button{display:flex;width:100%;min-height:2rem;align-items:center;padding:.35rem .5rem;border:0;border-radius:.4rem;background:transparent;color:var(--qsh-text);font:inherit;font-size:.8rem;text-align:left}.qupid-service-header .service-theme-menu button:hover{background:var(--qsh-control-hover)}.qupid-service-header .service-theme-menu button.active{background:var(--qsh-accent-soft);color:var(--qsh-accent-text);font-weight:800}
.qupid-service-header .user-name{max-width:12rem;overflow:hidden;text-overflow:ellipsis;color:var(--qsh-text)}.qupid-service-header .link-button{border:0!important;background:transparent!important;color:var(--qsh-muted)!important;padding:.35rem .1rem!important}.qupid-service-header .link-button:hover{color:var(--qsh-text)!important;text-decoration:underline}

@media(max-width:56rem){.qupid-service-header{grid-template-columns:auto 1fr auto;gap:.55rem;padding-inline:max(.65rem,var(--qupid-safe-left,0px)) max(.65rem,var(--qupid-safe-right,0px))}.qupid-service-header-center{min-width:0}.qupid-service-header .workspace-top-search{max-width:none!important}.qupid-service-header .user-name{display:none}.qupid-service-brand{width:2.45rem;height:2.45rem}.qupid-service-brand img{width:2.35rem!important;height:2.35rem!important}}
@media(max-width:43rem){.qupid-service-header{grid-template-columns:auto 1fr}.qupid-service-header-center{display:none}.qupid-service-header-end{justify-self:end}.qupid-service-header .service-switcher a{width:2rem!important;height:2rem!important;min-height:2rem!important}.qupid-service-header .service-settings-button{width:2rem!important;height:2rem!important;min-width:2rem}.qupid-service-header .link-button{display:none!important}}
.qupid-language-switch{display:flex;align-items:center;margin:0}.qupid-language-switch .input{width:auto;min-width:5.8rem;padding:.35rem 1.7rem .35rem .55rem;font-size:.82rem}

/* Mobile Reserve drawer stays below service chrome; narrow controls cannot collide. */
@media(max-width:47.99rem){
  body:not(.workspace-service-body):not(.file-service-body) .sidebar{top:calc(var(--qupid-safe-top,0px) + var(--qsh-h));bottom:var(--qupid-safe-bottom,0px);height:auto;z-index:190}
  body:not(.workspace-service-body):not(.file-service-body) .nav-backdrop{top:calc(var(--qupid-safe-top,0px) + var(--qsh-h));z-index:185}
}
@media(max-width:26rem){
  .qupid-service-header{gap:.25rem;padding-inline:max(.35rem,var(--qupid-safe-left,0px)) max(.35rem,var(--qupid-safe-right,0px))}
  .qupid-service-header-start{gap:.15rem}.qupid-service-brand{display:none!important}
  .qupid-service-header .service-switcher{max-width:7rem;overflow-x:auto;scrollbar-width:none}.qupid-service-header .service-switcher::-webkit-scrollbar{display:none}
  .qupid-language-switch .input{min-width:4.8rem!important;width:4.8rem!important;padding-right:1.2rem}
  .qupid-service-header-end{gap:.3rem}
}

/* User-supplied Code marks. Both originals have black ink; dark surfaces invert
   the display only, preserving the original image files. */
.qupid-code-icon{display:inline-flex;width:20px;height:20px;flex:none;vertical-align:middle}
.qupid-code-icon img{width:100%;height:100%;object-fit:contain}
.qupid-code-icon .code-icon-on-dark{display:none;filter:invert(1)}
html[data-theme="dark"] .qupid-code-icon .code-icon-on-light{display:none}
html[data-theme="dark"] .qupid-code-icon .code-icon-on-dark{display:block}
#codeApp .qupid-code-icon .code-icon-on-light{display:none}
#codeApp .qupid-code-icon .code-icon-on-dark{display:block}
#codeApp[data-theme="vs"] .qupid-code-icon .code-icon-on-light{display:block}
#codeApp[data-theme="vs"] .qupid-code-icon .code-icon-on-dark{display:none}

.qupid-code-mark{width:20px;height:20px;display:inline-block;flex:none;vertical-align:middle;color:inherit}

/* Original transparent service artwork adopts the existing navigation palette.
   Alpha masking keeps cutouts transparent in light, dark and selected states. */
.qupid-service-icon{display:inline-block;flex:none;width:1.35rem;height:1.35rem;vertical-align:middle;background-color:currentColor;-webkit-mask-image:var(--qsi-light);mask-image:var(--qsi-light);-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-mode:alpha}
html[data-theme="dark"] .qupid-service-icon{-webkit-mask-image:var(--qsi-dark);mask-image:var(--qsi-dark)}
@media(forced-colors:active){.qupid-service-icon{forced-color-adjust:none;background-color:ButtonText}.service-switcher a.active .qupid-service-icon,.member-shell-tabs button[aria-current="page"] .qupid-service-icon{background-color:Highlight}}

/* Desktop service artwork has a full-canvas silhouette, while the 24-unit
   outline SVGs include their own inset. Match painted size, not canvas size.
   The mobile launcher and its icon sizing keep their existing rules. */
@media(min-width:960px){
  .qupid-service-header .service-switcher a>svg,
  .member-shell-header .member-shell-tabs button>svg{
    display:block;width:1.5rem!important;height:1.5rem!important;flex:none;
  }
  .qupid-service-header .service-switcher a>.qupid-service-icon,
  .member-shell-header .member-shell-tabs button>.qupid-service-icon{
    display:block;width:1.25rem;height:1.25rem;flex:none;
  }
}
