/* ─────────────────────────────────────────────────────────────────────────────
   site-account.css — the signed-in parts of the nav, shared by the homepage
   (landing.html) and every page that uses /assets/site-chrome.css:

   - the account button (avatar + first name) and its menu
   - the dashboard button beside "Send us your contract"
   - the order of the right-hand group (account button last) and the reserved slots

   The markup is written by /assets/site-nav.js (window.ccNav). One copy only:
   if this changes, it changes on every page at once. Uses the Night Sky tokens
   both landing.html and site-chrome.css define on :root.
   ───────────────────────────────────────────────────────────────────────────── */
.auth-slot{display:flex;align-items:center;flex-shrink:0}
.nav-r .auth-slot:empty{display:none}
.auth-item{position:relative}
html.auth-likely-signed-in #navSignin{display:none!important}

/* the account button */
.auth-pill{display:inline-flex;align-items:center;gap:8px;height:36px;padding:3px 12px 3px 3px;border-radius:99px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);color:rgba(255,255,255,.85);font:500 13px/1 var(--sans);cursor:pointer;transition:background-color .15s,border-color .15s;white-space:nowrap;text-decoration:none}
.auth-pill:hover{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.18)}
.auth-pill:focus-visible{outline:1px solid var(--teal-hi);outline-offset:3px}
.auth-avatar{width:28px;height:28px;border-radius:50%;background:#2B4590;display:flex;align-items:center;justify-content:center;color:#fff;font:600 12px/1 var(--sans);flex-shrink:0;overflow:hidden}
.auth-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.auth-name{max-width:140px;overflow:hidden;text-overflow:ellipsis}
.auth-chev{width:10px;height:10px;opacity:.5;transition:transform .2s var(--out),opacity .2s;flex-shrink:0;margin-right:4px}
.auth-pill.auth-open .auth-chev{transform:rotate(180deg);opacity:.8}

/* the menu: centred directly under the account button (it does not swing out to one side); a short fade and rise in, a quicker fade out */
.auth-dd{position:absolute;top:calc(100% + 10px);left:50%;width:max-content;min-width:232px;max-width:min(300px,calc(100vw - 32px));padding:6px 0;
  background:rgba(14,24,32,.97);-webkit-backdrop-filter:blur(16px) saturate(1.2);backdrop-filter:blur(16px) saturate(1.2);
  border:1px solid var(--line2);border-radius:6px;box-shadow:0 18px 48px -18px rgba(0,0,0,.7);
  font-family:var(--sans);text-align:left;z-index:300;
  opacity:0;pointer-events:none;translate:-50% 0;transform:translateY(6px);
  transition:opacity .14s ease-in,transform .14s ease-in}
/* closed, the menu is also inert (set by site-nav.js), so it cannot take focus or be read out */
.auth-dd.auth-show{opacity:1;pointer-events:auto;transform:none;transition:opacity .18s var(--out),transform .24s var(--out)}
.auth-dd-header{padding:12px 18px 13px;border-bottom:1px solid var(--line);margin-bottom:6px}
.auth-dd-name{font:500 15px/1.3 var(--sans);color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.auth-dd-email{margin-top:3px;font:400 13.5px/1.35 var(--sans);color:var(--tx3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.auth-dd-link{display:block;width:100%;padding:10px 18px;border:0;background:none;text-align:left;text-decoration:none;font:400 15px/1.3 var(--sans);color:var(--tx2);cursor:pointer;transition:color .15s,background-color .15s}
.auth-dd-link:hover,.auth-dd-link:focus-visible{color:#fff;background:rgba(255,255,255,.04);outline:none}
.auth-dd-link:focus-visible{box-shadow:inset 2px 0 0 var(--teal-hi)}
.auth-dd-sep{height:1px;margin:6px 0;background:var(--line)}

/* Option E: label followed by a hairline count, when available. */
.btn2{display:inline-flex;align-items:center;text-decoration:none;font:500 13px/1 var(--sans);white-space:nowrap}
:root{--dash-fill:transparent;--dash-fill-hi:rgba(174,185,194,.16);--dash-ink:#C7D0D5;--dash-rim:rgba(174,185,194,.3);--dash-rim-hi:#F3F1EC}
.btn2{box-sizing:border-box;height:37px;align-self:center;gap:8px;padding:0 16px;border:1px solid var(--dash-rim);border-radius:99px;background:var(--dash-fill);color:var(--dash-ink);
  transition:border-color .15s var(--out),background-color .15s var(--out),transform .15s var(--out)}
.btn2:hover,.btn2.is-hover{border-color:var(--dash-rim-hi);background:var(--dash-fill-hi);color:#F3F1EC}
.btn2:active{transform:translateY(1px);border-color:rgba(141,208,203,.55);background:#1A2934;color:#F3F1EC}
.btn2:focus-visible{outline:2px solid var(--teal-hi);outline-offset:3px;transition:none}
.dash-count{min-width:18px;height:18px;border:1px solid rgba(174,185,194,.55);border-radius:50%;display:inline-grid;place-items:center;font:600 11px/1 var(--sans);color:#F3F1EC;flex:none;animation:dash-count-in .18s ease-out both}
.dash-count:not(:first-child){margin-left:8px}
@keyframes dash-count-in{from{opacity:0}to{opacity:1}}
.auth-dd-link .dash-count{vertical-align:middle;margin-left:8px}
@media (prefers-reduced-motion:reduce){
  .btn2,.dash-count{transition:none;animation:none}
  .btn2:active{transform:none}
}

/* ── the right-hand group, in order: dashboard button, upload button, then the account button (signed in) or
   "Sign in" (signed out) last, at the far right. CSS order only, so the page markup stays the same everywhere.
   Paul 2026-11-07: the account button loads late, so its slot and the dashboard button's slot are reserved from
   first paint (nav-auth-boot.js sets html.auth-likely-signed-in before the body renders). Every box in the bar
   has a fixed size whatever the name, photo or role, so nothing moves by even a pixel when they arrive. ── */
.nav-r{--cc-dash-w:148px;--cc-dash-pull:-16px;--cc-chip-w:136px}
.nav-r #navDash{order:1}
.nav-r #navCta{order:2}
.nav-r #navSignin,.nav-r .auth-slot{order:3}
.nav-r #navDash{box-sizing:border-box;width:max-content;min-width:var(--cc-dash-w);justify-content:center}
.nav-r .btn2{margin-right:var(--cc-dash-pull)}
/* the dashboard button's space, held until the role is known ("Admin portal" or "My contracts": same width) */
html.auth-likely-signed-in .nav-r:not(:has(#navDash))::before{content:"";order:1;flex:0 0 var(--cc-dash-w);height:38px;margin-right:var(--cc-dash-pull)}
/* the account button's slot: fixed width, a neutral avatar placeholder until the photo and name arrive */
html.auth-likely-signed-in .nav-r .auth-slot{display:flex;flex:0 0 var(--cc-chip-w);width:var(--cc-chip-w);height:36px}
html.auth-likely-signed-in .nav-r .auth-slot:empty::before{content:"";flex:1;height:36px;box-sizing:border-box;border-radius:99px;border:1px solid rgba(255,255,255,.1);
  background:radial-gradient(circle 14px at 17px 50%,rgba(174,185,194,.22) 13.5px,transparent 14px),rgba(255,255,255,.05)}
html.auth-likely-signed-in .nav-r .auth-item{flex:1;min-width:0}
html.auth-likely-signed-in .nav-r .auth-pill{box-sizing:border-box;width:100%}
html.auth-likely-signed-in .nav-r .auth-name{flex:1;min-width:0;max-width:none}

/* signed in, the bar carries one more button: keep the centre links on one line by first showing the account
   button as the avatar alone, then folding the links away earlier than the signed-out 1060px. Keyed on the
   signed-in state, not on the dashboard button, so the layout is already final before the role arrives. */
.nav-links a{white-space:nowrap}
/* every width, not only up to 1440 (2026-11-08): above 1440 the container stays 1248px, so with the 148px
   "My contracts" tab the name button ran the group ~60px past it. The first name stays in the account menu. */
html.auth-likely-signed-in .nav-r{gap:24px;--cc-dash-pull:-12px;--cc-chip-w:66px}
html.auth-likely-signed-in .nav-r .auth-name{display:none}
html.auth-likely-signed-in .nav-r .auth-pill{padding-right:10px;justify-content:space-between}
/* From 1248px the container is a fixed 1248px (1184px inside), so every gap is fixed too. Measured with the real
   DM Sans, the bar needs ~1053px plus the account slot, so the gaps are a little tighter from here up: links 26->16,
   logo/links/group 24->18, upload-to-account 24->16 (dashboard-to-upload stays 12). That also fixes the avatar-only
   bar at 1248-1262px viewports, where a classic scrollbar left the container ~15px short and the group ran ~10px
   past it (review F2, 2026-11-10). */
@media(min-width:1248px){
  html.auth-likely-signed-in .nav .wrap{gap:18px}
  html.auth-likely-signed-in .nav .nav-links{gap:16px}
  html.auth-likely-signed-in .nav-r{gap:16px;--cc-dash-pull:-4px}
}
@media(min-width:1248px){html.auth-likely-signed-in .nav-r:has(.dash-count){gap:12px}}
/* the chosen name beside the avatar (Paul, 2026-11-10) once the container is a full 1248px even with a classic
   scrollbar (1280px). The container stays 1248px so the logo keeps lining up with the page. The chevron gives way
   to the name here (the button still opens the same menu), so the 124px slot leaves the name ~73px, about 10-11
   letters; a longer name ends in an ellipsis. ~6px of the bar is left spare for font rendering differences. The
   slot is a fixed width reserved from first paint, so the name arriving moves nothing. Same for both roles. */
@media(min-width:1280px){
  html.auth-likely-signed-in .nav-r{--cc-chip-w:124px}
  html.auth-likely-signed-in .nav-r .auth-name{display:block;text-align:left}
  html.auth-likely-signed-in .nav-r .auth-chev{display:none}
}
/* folded below 1248px, not 1220px: under 1248 the bar is narrower than its 1248px container and the right-hand
   group ran into the right margin (by up to 20px with the old button too) */
@media(max-width:1247px){
  html.auth-likely-signed-in .nav .nav-links{display:none}
  html.auth-likely-signed-in .nav .wrap{justify-content:space-between}
}
@media(max-width:860px){
  .nav-r .auth-name,.nav-r .auth-chev{display:none}
  .nav-r .auth-pill{padding:3px}
  html.auth-likely-signed-in .nav-r{--cc-chip-w:36px}
  html.auth-likely-signed-in .nav-r .auth-pill{padding:3px}
  /* on a phone the dashboard link lives in the account menu */
  .nav-r .btn2,html.auth-likely-signed-in .nav-r:not(:has(#navDash))::before{display:none}
}
@media (prefers-reduced-motion:reduce){
  .auth-dd,.auth-dd.auth-show{transform:none;transition:opacity .01ms}
}
/* phones: the name button sits near the right edge, so keep the menu's right edge on the button there */
@media(max-width:860px){.auth-dd{left:auto;right:0;translate:none}}

/* ── page-to-page transitions (Paul, 2026-11-07) ──────────────────────────────
   Here because every public and signed-in page loads this file (landing.html too,
   which does not load site-chrome.css). Same-origin navigations between two pages
   that both opt in cross-fade the page softly; the top nav (#nav) is lifted into its
   own layer and swapped instantly, so it stays still instead of fading. Browsers
   without cross-document View Transitions just navigate normally. No JS. */
@view-transition{navigation:auto}
::view-transition-old(root),::view-transition-new(root){animation-duration:240ms;animation-timing-function:cubic-bezier(.4,0,.2,1)}
#nav{view-transition-name:cc-site-nav}
::view-transition-group(cc-site-nav){animation:none}
::view-transition-old(cc-site-nav){display:none}
::view-transition-new(cc-site-nav){animation:none}
@media (prefers-reduced-motion:reduce){
  @view-transition{navigation:none}
}
