/* Shared structural shell for client, authentication and signed-in workspace views. */
.site-topbar-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;min-width:0}
.site-topbar-identity{display:inline-flex;align-items:center;gap:9px;color:#f3f3f3;font-size:12px;min-width:0}
.site-topbar-identity[hidden],.site-topbar-signout[hidden]{display:none!important}
.site-topbar-identity .avatar{width:32px;height:32px;flex-basis:32px}
.site-topbar-signout{font:inherit;cursor:pointer}
.site-topbar-home-label{display:inline}
.legacy-workspace-page{--portal-bg:var(--bg,#f7f7f5);--portal-ink:var(--ink,#171717);--portal-muted:var(--muted,#747474);--portal-line:var(--line,#e6e6e2);--portal-card:var(--surface,#fff);min-height:100vh;background:var(--portal-bg);color:var(--portal-ink)}
.legacy-workspace-page .legacy-portal-shell{display:grid;grid-template-columns:250px minmax(0,1fr);align-items:stretch;gap:0;min-height:calc(100vh - 76px);width:100%}
.legacy-workspace-page .portal-sidebar{box-sizing:border-box;position:sticky;top:76px;display:flex;flex-direction:column;align-self:start;gap:24px;width:100%;height:calc(100vh - 76px);min-height:440px;overflow:auto;padding:24px 18px;background:var(--portal-card);border:0;border-right:1px solid var(--portal-line);border-radius:0;box-shadow:none}
.legacy-workspace-page .portal-brand{display:block;padding:4px 10px;color:var(--portal-ink);font:700 17px/1.2 "Space Grotesk","DM Sans",sans-serif;letter-spacing:-.04em}
.legacy-workspace-page .portal-brand span{display:block;margin-top:5px;color:var(--portal-muted);font:700 10px/1.3 "DM Sans",sans-serif;letter-spacing:1.4px;text-transform:uppercase}
.legacy-workspace-page .auth-sidebar-copy{padding:18px 14px;border-radius:16px;background:#080808;color:#fff}
.legacy-workspace-page .auth-sidebar-copy h1{margin:16px 0 10px;font-size:clamp(22px,2.2vw,27px);line-height:1.1;letter-spacing:-.05em}
.legacy-workspace-page .auth-sidebar-copy p{font-size:12px;line-height:1.7;color:#c5c5c5}
.legacy-workspace-page .auth-sidebar-copy .small{font-size:11px;color:#a0a0a0!important;margin-top:18px}
.legacy-workspace-page .side-label{padding:0 10px}
.legacy-workspace-page .side-label .eyebrow{font-size:10px;letter-spacing:1.4px}
.legacy-workspace-page .portal-nav{display:grid;gap:5px;min-width:0}
.legacy-workspace-page .portal-nav button{display:flex;align-items:center;gap:10px;width:100%;min-width:0;padding:11px 12px;border:1px solid transparent;border-radius:12px;background:transparent;color:var(--portal-muted);text-align:left;font:600 13px/1.3 "DM Sans",sans-serif}
.legacy-workspace-page .portal-nav button:hover,.legacy-workspace-page .portal-nav button.active{background:var(--soft,#f0f0ec);color:var(--portal-ink)}
.legacy-workspace-page .portal-nav .glyph{width:20px;flex:0 0 20px;text-align:center;font-size:16px}
.legacy-workspace-page .portal-sidebar-bottom{display:grid;gap:12px;margin-top:auto;padding-top:15px;border-top:1px solid var(--portal-line)}
.legacy-workspace-page .portal-user{display:flex;align-items:center;gap:10px;min-width:0;padding:2px 4px}
.legacy-workspace-page .portal-user>div:last-child{min-width:0}
.legacy-workspace-page .portal-user strong,.legacy-workspace-page .portal-user small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.legacy-workspace-page .portal-user strong{font-size:12px}
.legacy-workspace-page .portal-user small{margin-top:3px;color:var(--portal-muted);font-size:10px}
.legacy-workspace-page .portal-main{box-sizing:border-box;width:100%;max-width:none;min-width:0;margin:0;padding:34px clamp(20px,4vw,56px) 48px}
.legacy-workspace-page .legacy-main{min-width:0}
.legacy-workspace-page .portal-auth-view{display:block;width:min(100%,650px);max-width:none;margin:clamp(30px,8vh,90px) auto 30px;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}
.legacy-workspace-page .legacy-auth-card{box-sizing:border-box;width:100%;max-width:none;min-width:0;padding:clamp(24px,4vw,44px);border:1px solid var(--portal-line);border-radius:22px;background:var(--portal-card);box-shadow:var(--shadow,0 12px 40px rgba(0,0,0,.045))}
.legacy-workspace-page .legacy-auth-card h2{font-size:clamp(25px,3vw,32px);margin:8px 0}
.legacy-workspace-page .legacy-auth-card .auth-form{margin-top:20px}
.legacy-workspace-page .legacy-auth-card .muted{line-height:1.7}
.legacy-workspace-page.auth-shell-active .side-label,.legacy-workspace-page.auth-shell-active .portal-nav,.legacy-workspace-page.auth-shell-active .portal-sidebar-bottom{display:none!important}
.legacy-workspace-page:not(.auth-shell-active) .auth-sidebar-copy{display:none!important}
.legacy-workspace-page #loading-view{max-width:760px;margin:0 auto;padding:clamp(46px,10vh,100px) 8px;text-align:center}
.legacy-workspace-page #workspace-view{width:100%;min-width:0}
.legacy-workspace-page #workspace-view>.portal-topbar{position:static;display:flex;align-items:flex-start;justify-content:space-between;gap:22px;width:100%;height:auto;min-height:0;margin:0 0 30px;padding:0 0 24px;border:0;border-bottom:1px solid var(--portal-line);border-radius:0;background:transparent;color:var(--portal-ink)}
.legacy-workspace-page #workspace-view>.portal-topbar h1{font-size:clamp(30px,3.5vw,42px);line-height:1.1;letter-spacing:-.055em}
.legacy-workspace-page #workspace-view>.portal-topbar p{max-width:650px;color:var(--portal-muted);font-size:13px;line-height:1.7}
.legacy-workspace-page .portal-workspace-content{min-width:0}
.legacy-workspace-page .portal-workspace-content .panel,.legacy-workspace-page .portal-workspace-content .stat{background:var(--portal-card);border-color:var(--portal-line)}
.legacy-workspace-page .foot{margin-top:32px;padding-top:18px;border-top:1px solid var(--portal-line);color:var(--portal-muted);font-size:11px;text-align:center}
html[data-theme="dark"] .legacy-workspace-page .auth-sidebar-copy{background:#080808;border:1px solid #262626}
html[data-theme="dark"] .legacy-workspace-page .portal-nav button:hover,html[data-theme="dark"] .legacy-workspace-page .portal-nav button.active{background:#171717;color:#f5f5f5}
@media(max-width:900px){
 .site-topbar-identity{display:none!important}
 .legacy-workspace-page .legacy-portal-shell{grid-template-columns:1fr}
 .legacy-workspace-page .portal-sidebar{position:relative;top:auto;height:auto;min-height:0;gap:14px;padding:17px 18px;border-right:0;border-bottom:1px solid var(--portal-line);overflow:visible}
 .legacy-workspace-page.auth-shell-active .auth-sidebar-copy{max-width:620px}
 .legacy-workspace-page:not(.auth-shell-active) .portal-sidebar .side-label{display:none}
 .legacy-workspace-page:not(.auth-shell-active) .portal-sidebar .portal-sidebar-bottom{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:0}
 .legacy-workspace-page .portal-nav{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
 .legacy-workspace-page .portal-nav button{justify-content:center;padding:10px 6px;text-align:center}
 .legacy-workspace-page .portal-nav .glyph{width:auto;flex:0 0 auto}
 .legacy-workspace-page .portal-main{padding:28px 20px 40px}
}
@media(max-width:600px){
 .site-topbar-home-label{display:none}
 .site-topbar-actions{gap:7px}
 .legacy-workspace-page .portal-sidebar{padding:15px 12px}
 .legacy-workspace-page .portal-brand{font-size:15px}
 .legacy-workspace-page .auth-sidebar-copy{padding:18px 14px}
 .legacy-workspace-page .portal-main{padding:22px 14px 36px}
 .legacy-workspace-page .portal-nav{grid-template-columns:repeat(2,minmax(0,1fr))}
 .legacy-workspace-page #workspace-view>.portal-topbar{flex-direction:column;align-items:stretch;gap:14px}
 .legacy-workspace-page #workspace-view>.portal-topbar>.btn{align-self:flex-start}
 .legacy-workspace-page .legacy-auth-card{padding:22px 18px}
}

/* Keep the shared theme control and website-return link in a stable, non-overlapping row. */
.site-topbar,
body>header.top:not(#hd){
  box-sizing:border-box;
  min-width:0;
}
.site-topbar-brand,
body>header.top:not(#hd) .brand{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.site-topbar-actions,
body>header.top:not(#hd) .top-right{
  position:static;
  display:flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
  gap:10px;
  min-width:0;
}
.site-topbar-actions>*,
body>header.top:not(#hd) .top-right>*{
  position:static;
  flex-shrink:0;
  margin:0;
}
.site-topbar .theme-toggle,
.site-topbar .site-topbar-home,
body>header.top:not(#hd) .theme-toggle,
body>header.top:not(#hd) .back-to-site{
  box-sizing:border-box;
  vertical-align:middle;
}
@media(max-width:560px){
  .site-topbar{gap:8px;padding-inline:12px}
  .site-topbar-brand,body>header.top:not(#hd) .brand{font-size:12px;letter-spacing:-.035em}
  .site-topbar-actions,body>header.top:not(#hd) .top-right{gap:6px}
  .site-topbar .theme-toggle{width:36px;min-width:36px;flex-basis:36px;height:36px;min-height:36px}
  .site-topbar .site-topbar-home{width:36px;min-width:36px;min-height:36px;padding:0}
  body>header.top:not(#hd) .theme-toggle,
  body>header.top:not(#hd) .back-to-site{width:36px;min-width:36px;height:36px;min-height:36px;padding:0}
}
@media(max-width:340px){
  .site-topbar-brand,body>header.top:not(#hd) .brand{max-width:calc(100vw - 120px)}
}

/* Alignment pass: prevent flex/grid children and controls from overflowing. */
.portal-topbar,.portal-section-head,.panel-head,.portal-header-actions,.portal-top-actions{min-width:0;flex-wrap:wrap;align-items:center;gap:12px}
.portal-topbar>* , .portal-section-head>* , .panel-head>*{min-width:0}
.portal-main,.portal-shell,.portal-grid,.portal-two-col,.portal-card,.metric-card{min-width:0}
.portal-form,.portal-table,.table-wrap{max-width:100%;min-width:0}
.portal-body button,.portal-body a.button,.portal-body .portal-button{min-height:40px;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1.2;white-space:normal;text-align:center}
.portal-body input,.portal-body select,.portal-body textarea{max-width:100%;min-width:0}
@media(max-width:850px){.portal-shell{grid-template-columns:1fr!important}.portal-sidebar{position:static!important;height:auto!important;min-height:0!important;overflow:visible!important;padding:16px!important;gap:14px!important}.portal-main{padding:24px clamp(14px,4vw,28px)!important}.portal-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.portal-topbar{align-items:flex-start!important}}
@media(max-width:600px){.portal-main{padding:18px 12px 30px!important}.portal-topbar{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:12px!important;margin-bottom:22px!important}.portal-topbar>.button,.portal-topbar>.portal-button{width:100%!important}.portal-tabs{display:flex;flex-wrap:wrap;gap:6px!important}.portal-tab{max-width:100%;flex:1 1 auto;min-width:120px}.portal-grid{grid-template-columns:1fr!important}.portal-two-col{grid-template-columns:1fr!important}.portal-card,.metric-card{padding:16px!important}.portal-section-head,.panel-head{align-items:flex-start!important;flex-direction:column!important}.portal-section-head>*:last-child,.panel-head>*:last-child{max-width:100%}.portal-form{grid-template-columns:1fr!important}.field.full{grid-column:auto!important}.portal-body button,.portal-body .button,.portal-body .portal-button{max-width:100%}.portal-table{overflow-x:auto}}


/* GREAT UNIFICATION — signed-in identity and sign-out never compete for header space. */
.site-topbar.top{
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:clamp(10px,2vw,22px);
  min-width:0;
}
.site-topbar.top .site-topbar-brand{
  flex:0 1 auto;
  min-width:0;
  max-width:min(34vw,280px);
}
.site-topbar.top .site-topbar-actions,
.site-topbar.top .top-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex:0 1 auto;
  flex-wrap:nowrap;
  gap:clamp(6px,1vw,10px);
  min-width:0;
  max-width:72%;
}
.site-topbar.top .site-topbar-identity,
.site-topbar.top #top-identity{
  display:inline-flex!important;
  align-items:center;
  flex:0 1 auto;
  gap:8px;
  min-width:0;
  max-width:clamp(84px,19vw,190px);
}
.site-topbar.top .site-topbar-identity [data-user-name],
.site-topbar.top #top-name,
.site-topbar.top .site-topbar-identity a{
  display:block;
  min-width:0;
  max-width:clamp(60px,15vw,150px);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-family:var(--site-font-body,"DM Sans",Arial,sans-serif);
  font-size:12px;
  font-weight:600;
  line-height:1.2;
}
.site-topbar.top .site-topbar-signout,
.site-topbar.top #top-signout{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:max-content;
  min-height:40px;
  padding:0 14px;
  white-space:nowrap;
  font-family:var(--site-font-body,"DM Sans",Arial,sans-serif)!important;
  font-size:12px!important;
  font-weight:600!important;
}
.site-topbar.top .site-topbar-identity[hidden],
.site-topbar.top #top-identity[hidden],
.site-topbar.top .site-topbar-signout[hidden],
.site-topbar.top #top-signout[hidden]{
  display:none!important;
}
@media(max-width:900px){
  .site-topbar.top{
    height:auto!important;
    min-height:64px;
    padding:8px 14px!important;
    gap:8px;
  }
  .site-topbar.top .site-topbar-brand{
    display:inline-flex!important;
    flex:0 1 auto;
    max-width:30vw;
    font-size:12px!important;
    line-height:1.15;
  }
  .site-topbar.top .site-topbar-actions,
  .site-topbar.top .top-right{
    flex:0 1 auto;
    max-width:70%;
    gap:6px!important;
    margin-left:auto;
  }
  .site-topbar.top .site-topbar-identity,
  .site-topbar.top #top-identity{
    max-width:clamp(64px,18vw,118px);
    gap:6px;
  }
  .site-topbar.top .site-topbar-identity [data-user-name],
  .site-topbar.top #top-name{
    max-width:clamp(52px,14vw,100px);
    font-size:11px;
  }
  .site-topbar.top .site-topbar-signout,
  .site-topbar.top #top-signout{
    min-height:36px;
    padding:0 11px;
    font-size:11px!important;
  }
  .site-topbar.top .site-topbar-home.back-to-site{
    width:36px;
    min-width:36px;
    height:36px;
    min-height:36px;
    padding:0!important;
  }
}
@media(max-width:480px){
  .site-topbar.top{
    min-height:62px;
    padding:7px 10px!important;
    gap:6px;
  }
  .site-topbar.top .site-topbar-brand{
    max-width:30vw;
    font-size:11px!important;
    letter-spacing:-.035em;
  }
  /* The linked brand already returns home; remove the duplicate arrow at phone widths. */
  .site-topbar.top .site-topbar-home.back-to-site{
    display:none!important;
  }
  .site-topbar.top .site-topbar-actions,
  .site-topbar.top .top-right{
    max-width:70%;
    gap:5px!important;
  }
  .site-topbar.top .site-topbar-identity,
  .site-topbar.top #top-identity{
    max-width:clamp(48px,17vw,64px);
    gap:0;
    font-size:10px;
  }
  .site-topbar.top .site-topbar-identity .avatar,
  .site-topbar.top #top-avatar{
    display:none!important;
  }
  .site-topbar.top .site-topbar-identity [data-user-name],
  .site-topbar.top #top-name{
    max-width:clamp(48px,17vw,64px);
    font-size:10px;
  }
  .site-topbar.top .theme-toggle{
    width:34px;
    min-width:34px;
    height:34px;
    min-height:34px;
    flex-basis:34px;
  }
  .site-topbar.top .site-topbar-signout,
  .site-topbar.top #top-signout{
    min-height:34px;
    padding:0 9px;
    font-size:10px!important;
  }
}
@media(max-width:360px){
  .site-topbar.top .site-topbar-brand{max-width:27vw}
  .site-topbar.top .site-topbar-identity,
  .site-topbar.top #top-identity,
  .site-topbar.top .site-topbar-identity [data-user-name],
  .site-topbar.top #top-name{max-width:48px}
}

/* Role navigation in signed-in headers: no homepage return action in workspace. */
.site-topbar-actions .site-topbar-home[aria-label="View website"],
.site-topbar-actions .site-topbar-home[title="View website"],
.site-topbar-actions .back-to-site[aria-label="Back to website"]{display:none!important}
/* Stable account cluster with separate columns and no text overlap. */
.site-topbar-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:nowrap;min-width:0}
.site-topbar-identity{max-width:min(28vw,180px);flex:0 1 auto}
.site-topbar-identity #top-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.site-topbar-signout{flex:0 0 auto;white-space:nowrap}
@media(max-width:560px){
 .site-topbar-actions{gap:5px}
 .site-topbar-identity{max-width:64px}
 .site-topbar-identity .avatar{display:none!important}
 .site-topbar-identity #top-name{max-width:64px;font-size:10px}
 .site-topbar-signout{min-height:34px!important;padding:0 9px!important;font-size:10px!important}
}
