/* Clydesdale HQ internal shell v1 — NOT a consumer stylesheet.
 * Layout informed by Big Brain; colors are Clydesdale approved palette.
 * Header + mobile bottom navigation. No traditional internal footer. */
.ch-shell,.ch-shell *,.ch-bottom-nav,.ch-bottom-nav *{box-sizing:border-box}
html[data-ch-internal-shell] [hidden]{display:none!important}
/* Keep the destination staged until its own data and shell are ready. The
 * placeholder has no document geometry, so a delayed response cannot move
 * page content or paint navigation independently of its destination. */
html[data-internal-loading] :is(main.ch-internal-page,#hq-search-workspace),
html:is([data-internal-loading],[data-review-loading="true"]) #hqInternalNav,
html:not([data-internal-load-failed]) body:has(#hqInternalHeader:empty) :is(main.ch-internal-page,#hq-search-workspace){
 visibility:hidden;opacity:0;pointer-events:none
}
html:is([data-internal-loading],[data-review-loading="true"]){background:#f3eee3}
html:is([data-internal-loading],[data-review-loading="true"]) body::before{
 content:"";position:fixed;z-index:340;top:50%;left:50%;width:20px;height:20px;
 margin:-10px 0 0 -10px;box-sizing:border-box;border:2px solid #10213f;
 border-right-color:transparent;border-radius:50%;pointer-events:none;
 animation:ch-internal-opening .8s linear infinite
}
@keyframes ch-internal-opening{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){html:is([data-internal-loading],[data-review-loading="true"]) body::before{animation:none}}
html[data-internal-startup-error] :is(main.ch-internal-page,#hq-search-workspace){display:none!important}
.ch-internal-startup-error{
 margin:24px auto;padding:0 16px;max-width:780px;color:#10213f;
 font:650 16px/1.4 system-ui,-apple-system,sans-serif
}
.ch-internal-startup-error[hidden]{display:none!important}
.ch-internal-startup-error button{
 min-height:44px;padding:9px 16px;border:1px solid #10213f;border-radius:6px;
 background:#f3eee3;color:inherit;font:inherit;cursor:pointer
}
#hqInternalHeader:empty{min-height:69px;background:#10213f;border-bottom:3px solid #6d2630;box-sizing:border-box}
.ch-shell{
 --ch-navy:#10213f;--ch-bone:#f3eee3;--ch-oxblood:#6d2630;--ch-ink:#171717;
 --ch-line:#d8d0c4;--ch-mobile-safe:env(safe-area-inset-bottom,0px);
 position:sticky;top:0;z-index:400;width:100%;max-width:none;
 background:var(--ch-navy);color:var(--ch-bone);
 border:0;border-bottom:3px solid var(--ch-oxblood);
 text-align:left;font:500 14px/1.4 system-ui,-apple-system,sans-serif;
 padding:0;margin:0;
}
.ch-shell__bar{display:flex;align-items:center;gap:9px;padding:10px 15px;max-width:1520px;margin:0 auto;min-height:66px}
.ch-shell__brand{display:block;flex:0 1 174px;min-width:108px;max-width:174px;line-height:0;padding:5px 0;border:0;text-decoration:none}
.ch-shell__brand img{width:100%;height:auto;display:block;filter:brightness(0) invert(1)}
.ch-shell__section{display:block;flex:none;padding:9px 10px;max-width:30vw;
  background:var(--ch-bone);border-left:3px solid var(--ch-oxblood);
  color:var(--ch-navy);font:850 11px/1.2 system-ui,-apple-system,sans-serif;
  letter-spacing:.075em;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-shell__toggle{display:grid;place-items:center;margin-left:auto;flex:none;
 width:45px;height:45px;border:1px solid #60728b;border-radius:9px;background:#1d314a;
 padding:0;color:var(--ch-bone);cursor:pointer;box-shadow:none}
.ch-shell__toggle-bars{width:21px;height:15px;display:block;border-top:2px solid currentColor;border-bottom:2px solid currentColor;position:relative}
.ch-shell__toggle-bars:after{content:"";position:absolute;left:0;right:0;top:5px;border-top:2px solid currentColor}
.ch-shell__backdrop{position:fixed;inset:0;width:100%;height:100%;z-index:1;background:#0613269e;border:0;padding:0;cursor:default}
.ch-shell__backdrop[hidden],.ch-shell__menu[hidden]{display:none!important}
.ch-shell .ch-shell__menu{position:fixed;z-index:2;top:var(--ch-menu-top,72px);right:12px;
 width:min(355px,calc(100vw - 24px));height:min(77dvh,710px);min-height:0;
 max-height:max(0px,calc(var(--ch-menu-viewport-bottom,100dvh) - var(--ch-menu-top,72px) - var(--ch-fixed-navigation-height,0px) - var(--ch-fixed-action-height,0px) - 8px));overflow:auto;display:flex;flex-direction:column;
 margin:0;padding:0;gap:0;flex-wrap:nowrap;align-items:stretch;border:1px solid var(--ch-line);border-radius:12px;
 background:var(--ch-bone);color:var(--ch-ink);box-shadow:0 18px 42px #08142550}
.ch-shell .ch-shell__menu--compact{height:auto;min-height:0}
.ch-shell__menu> *{flex-shrink:0}
.ch-shell__menu-title{font:850 18px/1.25 system-ui,-apple-system,sans-serif;
 color:var(--ch-navy);padding:20px 18px 10px;margin:0}
.ch-shell__links{display:flex;flex-direction:column;gap:2px;padding:0 11px 12px}
.ch-shell__links a,.ch-shell__policies a,.ch-shell__account a,.ch-shell__account button{
 display:block;border:0;border-radius:7px;background:transparent;box-shadow:none;
 color:var(--ch-ink);text-align:left;text-decoration:none;cursor:pointer;
 font:650 14px/1.3 system-ui,-apple-system,sans-serif;
 padding:12px 13px;width:100%;min-height:43px}
.ch-shell__links a:hover,.ch-shell__links a[aria-current="page"],
.ch-shell__policies a:hover,.ch-shell__account a:hover,.ch-shell__account button:hover{background:#e3dccf}
.ch-shell__policies{border-top:1px solid var(--ch-line);padding:12px 11px}
.ch-shell__policies strong,.ch-shell__account strong{
 display:block;margin:2px 13px 7px;color:#58534c;font:850 11px/1.4 system-ui;letter-spacing:.06em}
.ch-shell__account{margin-top:auto;border-top:1px solid var(--ch-line);
 background:#e9e2d7;padding:13px 11px 15px}
.ch-shell__account-status{display:block;color:#58534c;padding:0 13px 7px;
 font:500 12px/1.4 system-ui}
.ch-shell__brand:focus-visible,.ch-shell button:focus-visible,.ch-shell a:focus-visible,
.ch-bottom-nav button:focus-visible,.ch-bottom-nav a:focus-visible{outline:3px solid var(--ch-oxblood);outline-offset:3px}
.ch-bottom-nav{
 --ch-navy:#10213f;--ch-bone:#f3eee3;--ch-oxblood:#6d2630;
 /* Anchor from the viewport TOP, not fixed bottom:0. Mobile WebKit has
    mispainted bottom-fixed elements during native page load and navigation
    even while geometry APIs claimed the footer was positioned correctly.
    The shared measured height keeps wrapped labels and safe area in view. */
 position:fixed;z-index:350;left:0;right:0;
 top:calc(100vh - var(--ch-fixed-navigation-height,80px));bottom:auto;
 width:100%;height:auto;
 overflow-anchor:none;
 padding:7px 5px max(8px,env(safe-area-inset-bottom,0px));
 background:var(--ch-navy);color:var(--ch-bone);border-top:2px solid var(--ch-oxblood);
 display:grid;grid-template-columns:repeat(var(--ch-nav-columns,4),minmax(0,1fr));gap:3px;font-family:system-ui,-apple-system,sans-serif}
@supports(height:100svh){
 /* The small viewport is intentionally stable while Safari animates its
    toolbar during page load, scroll and a native link handoff. */
 .ch-bottom-nav{top:calc(100svh - var(--ch-fixed-navigation-height,80px))}
}
.ch-bottom-nav a,.ch-bottom-nav button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
 min-width:0;min-height:52px;border:0;border-radius:7px;padding:5px 2px;margin:0;
 color:var(--ch-bone);background:transparent;text-decoration:none;font:650 10px/1.2 system-ui;cursor:pointer}
.ch-bottom-nav a:is([aria-current="page"],[aria-current="location"]),.ch-bottom-nav button[aria-expanded="true"]{background:#34455c;border-bottom:2px solid var(--ch-oxblood)}
.ch-bottom-nav__icon{font-size:20px;line-height:1.05;min-height:20px}
.ch-internal-page{padding-bottom:calc(var(--ch-fixed-navigation-height,calc(80px + env(safe-area-inset-bottom,0px))) + var(--ch-fixed-action-height,0px) + 16px)!important}
html[data-ch-internal-shell]{scroll-padding-bottom:calc(var(--ch-fixed-navigation-height,calc(80px + env(safe-area-inset-bottom,0px))) + var(--ch-fixed-action-height,0px) + 16px)}
/* Page/task headings share the operator schema, including programmatically
 * focused Proof and Intelligence Report titles. The brand is independent. */
html[data-ch-internal-shell] .ch-internal-page :is(h1,h2,h3,h4){
 font-family:"Trebuchet MS","Segoe UI",Arial,sans-serif;letter-spacing:-.015em;color:#10213f
}
html[data-ch-internal-shell] .ch-internal-page h1{font-size:var(--ch-page-title-size,clamp(24px,4vw,32px));font-weight:600;line-height:1.2}
html[data-ch-internal-shell] .ch-internal-page h2{font-size:clamp(18px,2.6vw,22px);font-weight:600;line-height:1.3}
html[data-ch-internal-shell] .ch-internal-page h3{font-size:17px;font-weight:500;line-height:1.35}
html[data-ch-internal-shell] .ch-internal-page :is(h1,h2,h3,h4)[tabindex="-1"]:focus{outline:none}
@media(min-width:850px){
 .ch-bottom-nav{display:none}
 .ch-internal-page{padding-bottom:0!important}
}
@media(max-width:849px){
 .ch-shell__links--desktop,.ch-shell__links .ch-shell__desktop-link{display:none}
 /* Prevent iOS focus zoom without shrinking live review headline typography. */
 html[data-ch-internal-shell] .ch-internal-page :is(input,select,textarea):not([data-review-field]){
  font-size:max(16px,1em)!important;
 }
 /* An open native modal owns the interaction. On touch browsers, hide the
    fixed footer immediately, without waiting for Safari's delayed keyboard
    visualViewport resize. Closing the modal restores it automatically. */
 html[data-ch-internal-shell]:has(dialog[open]) .ch-bottom-nav{display:none!important}
 /* Keyboard panning must not carry fixed chrome through an editing field. */
 html[data-ch-keyboard-open="true"] .ch-bottom-nav{display:none!important}
 html[data-ch-keyboard-open="true"] .ch-shell{position:static!important}
 html[data-ch-keyboard-open="true"] .ch-internal-page :is(.writes-actions,.task-actions,.stage-actions,.ccc-content-task-bar){
  position:static!important;inset:auto!important;
 }
}
@media(max-width:395px){
 #hqInternalHeader:empty{min-height:63px}
 .ch-shell__bar{gap:7px;padding:8px 11px;min-height:60px}
 .ch-shell__brand{flex-basis:148px;min-width:96px}
 .ch-shell__section{font-size:10px;padding:8px;max-width:28vw}
 .ch-shell__toggle{width:43px;height:43px}
}

@media(max-width:849px){
 html[data-ch-internal-shell] textarea[data-ch-growing-editor]{box-sizing:border-box!important;max-height:none!important;overflow-y:hidden!important;resize:none!important;touch-action:auto}
}

/* Keep the document as the scroll owner. The last flex item sticks to the
   visible bottom and supplies its own intrinsic height on slow page handoffs. */
@media(max-width:849px){
 body[data-hq-flow-footer]{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
 /* Centered task containers keep their available width when a preview iframe
    has a larger intrinsic width. Its own scroll region handles that content. */
 body[data-hq-flow-footer]>main.ch-internal-page{box-sizing:border-box;min-width:0;width:-webkit-fill-available;width:stretch}
 .socials-page,body:has(#sections)>main.ch-internal-page{width:100%;margin-block:0}
 body[data-hq-flow-footer]>[data-hq-footer-mount]{
  /* Keep late-rendered task content above the navigation. */
  order:1;position:sticky;bottom:0;z-index:350;margin-top:auto;flex:none;overflow-anchor:none
 }
 body[data-hq-flow-footer]>[data-hq-footer-mount]>.ch-bottom-nav{position:static}
}
