/* Signal Architect Site-Wide 100% Zoom UX Density v1.0.0
   Purpose: synchronize Home, Chart, and research workspaces around a clean
   desktop-first 100% zoom baseline without changing research calculations. */

:root{
  --sa-ux-max:1480px;
  --sa-ux-gutter:clamp(14px,2.2vw,32px);
  --sa-ux-gap:clamp(12px,1.35vw,20px);
  --sa-ux-section:clamp(16px,1.8vw,26px);
}
html,body{max-width:100%;overflow-x:hidden}
body{line-height:1.45}
*,*::before,*::after{box-sizing:border-box}

/* One visual width system across public and research pages. */
body.sa-royal-theme > :is(header,nav,main,section,footer),
body.sa-royal-theme :is(.container,.shell,.page-shell,.site-shell,.app-shell,.cad-shell,.workspace-shell,.research-shell,.content-shell,
  .alpha24-home-grid,.target-grid,.phase14-grid,.relationships-shell,.positioning-shell,.market-attention-layout,.oi-main-grid,.il-workspace-stage,
  .ipe-shell,.lh-shell,.ar-shell,.ll-shell,.pulse-shell){
  max-width:var(--sa-ux-max);
}
:is(.container,.shell,.page-shell,.site-shell,.app-shell,.cad-shell,.workspace-shell,.research-shell,.content-shell,
   .relationships-shell,.positioning-shell,.market-attention-layout,.oi-main-grid,.il-workspace-stage,.ipe-shell,.lh-shell,.ar-shell,.ll-shell,.pulse-shell,.ta-shell){
  width:min(calc(100% - (2 * var(--sa-ux-gutter))),var(--sa-ux-max))!important;
  margin-left:auto!important;
  margin-right:auto!important;
}

/* Header/navigation: preserve space; never squeeze controls to unreadable sizes. */
.sa-global-header{gap:clamp(10px,1.3vw,22px)!important;padding:12px var(--sa-ux-gutter)!important}
.sa-global-header nav,.sa-global-nav,.main-nav,.tab-bar,.tabs,.subtabs{min-width:0}
@media (min-width:1101px){
  :is(.sa-global-nav,.main-nav,.tab-bar,.tabs,.subtabs){display:flex;flex-wrap:wrap!important;overflow-x:visible!important;row-gap:7px}
}
/* Workspace engine remains loaded, but its Beta control is intentionally not shown in production UX. */
.sa-workspace-control,[data-sa-workspace-ui]{display:none!important}

/* Natural desktop sizing. */
:is(button,.btn,.tab-btn,input,select,textarea){max-width:100%}
:is(button,.btn,.tab-btn){min-height:34px}
:is(input,select){min-height:38px}
textarea{min-width:0;overflow-wrap:anywhere}

/* Shared panel rhythm. */
:is(.panel,.card,.sa-u-section,.sa-ws-shell,.sa-adaptive-innovation,.sa-journey-foundation,.sa-plan-handoff,
    .m3-command-center,.m4-intelligence-panel,.scanner-panel,.regime-panel){
  min-width:0;
}
:is(.panel,.card,.sa-u-section,.sa-ws-shell,.sa-adaptive-innovation){margin-block:var(--sa-ux-gap)}

/* Common grids: reflow before they become cramped. */
:is(.grid-4,.cards-4,.metric-grid-4,.four-col){grid-template-columns:repeat(4,minmax(0,1fr))}
:is(.grid-3,.cards-3,.three-col){grid-template-columns:repeat(3,minmax(0,1fr))}
:is(.grid-2,.cards-2,.two-col,.split,.columns){grid-template-columns:repeat(2,minmax(0,1fr))}

/* Home and Chart share the same available width and spacing logic. */
#homeTab .alpha24-home-grid,#chartTab .target-grid.phase14-grid{width:100%!important;max-width:100%!important;gap:var(--sa-ux-gap)!important}
#chartTab .target-grid.phase14-grid>*{min-width:0}

/* Research Innovation: no five-column squeeze or internal page-like horizontal scroll. */
.sa-adaptive-innovation{padding:clamp(16px,1.6vw,24px)!important}
.sa-ai-header{gap:var(--sa-ux-gap)!important}
.sa-ai-workflow{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  overflow-x:visible!important;
  gap:10px!important;
}
.sa-ai-workflow li{min-width:0!important;min-height:0!important}
.sa-ai-form{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
.sa-ai-form .sa-ai-stage,.sa-ai-form .sa-ai-actions,.sa-ai-form .sa-ai-status{grid-column:1/-1!important}
.sa-ai-form textarea{min-height:110px!important;word-break:normal!important;overflow-wrap:break-word!important}
.sa-ai-boundary{align-items:flex-start!important}

/* Progressive disclosure for secondary material. */
.sa-density-disclosure{margin-top:14px;border:1px solid rgba(101,214,255,.18);border-radius:11px;background:rgba(2,11,16,.28);overflow:hidden}
.sa-density-disclosure>summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;cursor:pointer;color:#dff7ff;font-size:.72rem;font-weight:850;letter-spacing:.09em}
.sa-density-disclosure>summary::-webkit-details-marker{display:none}
.sa-density-disclosure>summary::after{content:'+';font-size:1.15rem;color:#65d6ff}
.sa-density-disclosure[open]>summary::after{content:'−'}
.sa-density-disclosure[open]>summary{border-bottom:1px solid rgba(101,214,255,.15)}
.sa-density-disclosure>.sa-density-body{padding:12px}
.sa-density-disclosure .sa-ai-form,.sa-density-disclosure .sa-ai-boundary{margin:0!important}

/* Wide tables/scanners scroll only inside their own region, never the page. */
:is(.table-wrap,.table-wrapper,.table-container,.data-table-wrap,.results-table,.watch-table,.scanner-panel,.scanner-rows){max-width:100%!important}
:is(.table-wrap,.table-wrapper,.table-container,.data-table-wrap,.results-table,.watch-table){overflow-x:auto!important;-webkit-overflow-scrolling:touch}

/* Mid-size desktop/laptop: reflow instead of compressing. */
@media (max-width:1280px){
  :is(.grid-4,.cards-4,.metric-grid-4,.four-col){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sa-ai-workflow{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sa-ai-form{grid-template-columns:1fr!important}
  .sa-ai-form>*{grid-column:1!important}
}
@media (max-width:1100px){
  :is(.grid-3,.cards-3,.three-col){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sa-global-header{flex-wrap:wrap!important}
  :is(.sa-global-nav,.main-nav,.tab-bar,.tabs,.subtabs){max-width:100%!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:thin}
  :is(.sa-global-nav,.main-nav,.tab-bar,.tabs,.subtabs)>*{flex:0 0 auto}
}
@media (max-width:820px){
  :is(.grid-2,.grid-3,.grid-4,.cards-2,.cards-3,.cards-4,.metric-grid-4,.two-col,.three-col,.four-col,.split,.columns){grid-template-columns:1fr!important}
  .sa-ai-header{display:block!important}
  .sa-ai-context{margin-top:12px!important;min-width:0!important}
  .sa-ai-workflow{grid-template-columns:1fr!important}
}
@media (max-width:560px){
  :root{--sa-ux-gutter:10px;--sa-ux-gap:10px}
  .sa-adaptive-innovation{padding:14px!important}
  .sa-density-disclosure>summary{padding:11px 12px}
}

/* Site-Wide UX Density v1.1.0 — alignment + mobile scanner follow-up */
/* Full-bleed header background with the navigation content aligned to the same
   centered width used by the application body. */
.sa-global-header{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding-left:max(var(--sa-ux-gutter),calc((100vw - var(--sa-ux-max))/2))!important;
  padding-right:max(var(--sa-ux-gutter),calc((100vw - var(--sa-ux-max))/2))!important;
}
.sa-global-header .sa-global-nav{max-width:100%;}

/* The scanner remains a table on desktop but becomes a readable information
   card on narrow screens instead of clipping columns outside its border. */
@media (max-width:760px){
  .scanner-panel{overflow:visible!important;}
  .scanner-panel .scanner-header{display:none!important;}
  .scanner-panel .scanner-rows{overflow:visible!important;gap:10px!important;}
  .scanner-panel .scanner-row{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px 12px!important;
    width:100%!important;
    padding:12px!important;
    overflow:visible!important;
  }
  .scanner-panel .scanner-row > *{
    display:block!important;
    min-width:0!important;
    overflow:visible!important;
    text-overflow:clip!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
  }
  .scanner-panel .scanner-row > *::before{
    content:attr(data-label);
    display:block;
    margin-bottom:3px;
    color:#78a897;
    font-size:8px;
    font-weight:800;
    letter-spacing:.08em;
    text-transform:uppercase;
  }
  .scanner-panel .scanner-row > strong{
    grid-column:1/-1;
    font-size:14px;
  }
  .scanner-panel .scanner-row > strong::before{display:none;}
  .scanner-panel .scanner-horizon-loading{grid-template-columns:1fr!important;}
  .scanner-panel .scanner-horizon-loading span{grid-column:1!important;}
}
@media (max-width:430px){
  .scanner-panel .scanner-row{grid-template-columns:1fr!important;}
  .scanner-panel .scanner-row > strong{grid-column:1!important;}
}
