/* AQE responsive financial UI contract: shared by the workspace and research pages. */
/* Standalone research pages share the customer palette without changing chart geometry. */
html:not([data-ui-profile]) body{background:var(--aqe-n-50,#F5F7FB);color:var(--aqe-panel-ink,#102338);font-family:"Avenir Next","PingFang SC","Noto Sans SC",sans-serif}
html:not([data-ui-profile]):has(link[href*="aqe-design-system.css"]) body{padding:0}
html:not([data-ui-profile]) body :is(.card,.panel){background:var(--aqe-n-0,#FFFFFF);border-color:var(--aqe-panel-border-soft,#D8E2EC);border-radius:18px;box-shadow:0 8px 28px rgb(25 59 96 / 5%)}
html:not([data-ui-profile]) body :is(h1,h2,h3){color:var(--aqe-panel-ink,#102338);letter-spacing:-.025em;line-height:1.25}
html:not([data-ui-profile]) body :is(button,.btn):not(.danger):not(.buy):not(.sell){background:var(--aqe-blue-600,#1B4F9C);color:var(--aqe-n-0,#FFFFFF);border:1px solid var(--aqe-blue-600,#1B4F9C);border-radius:12px;min-height:44px;padding:10px 17px}
html:not([data-ui-profile]) body :is(input,select,textarea){background:var(--aqe-n-25,#FBFCFE);color:var(--aqe-panel-ink,#102338);border:1px solid var(--aqe-panel-border,#C7D4E2);border-radius:12px}
html:not([data-ui-profile]) body :is(a,button,input,select,summary):focus-visible{outline:3px solid var(--aqe-blue-600,#1B4F9C);outline-offset:3px}
html:not([data-ui-profile]) body[data-experiment] nav a{display:flex;align-items:center;min-height:44px;padding:8px 14px;border:1px solid var(--aqe-panel-border-soft,#D8E2EC);border-radius:12px;background:var(--aqe-n-0,#FFFFFF);color:var(--aqe-blue-700,#143C78)}
html:not([data-ui-profile]) body[data-experiment] nav a[aria-current=page]{background:var(--aqe-blue-50,#EEF4FC);border-color:var(--aqe-blue-300,#8FB4E2)}
:root{
  --aqe-mobile-gutter:clamp(12px,4vw,20px);
  --aqe-chart-grid:rgba(71,85,105,.075);
  --aqe-chart-line:var(--aqe-n-200,#E0E6EF);
  --aqe-chart-surface:linear-gradient(180deg,rgb(255 255 255 / 98%),rgb(245 247 251 / 94%));
  --aqe-safe-bottom:max(12px,env(safe-area-inset-bottom));
}
html{max-width:100%;overflow-x:clip;text-size-adjust:100%;-webkit-text-size-adjust:100%}
body{max-width:100%;overflow-x:clip;text-rendering:optimizeLegibility}
:where(h1,h2,h3,h4,p,li,summary,dt,dd,button,a,label,small,strong){overflow-wrap:anywhere}
:where(img,video){max-width:100%;height:auto}
:where(button,a,input,select,textarea,summary){touch-action:manipulation}
:where(input,select,textarea,button){max-width:100%;font:inherit}

/* The marker is applied only to verified chart containers by responsive-finance.js. */
.aqe-financial-chart{
  position:relative;min-width:0;max-width:100%;isolation:isolate;overflow:hidden;
  border:1px solid var(--aqe-chart-line);border-radius:14px;background:var(--aqe-chart-surface);
  box-shadow:0 1px 2px rgba(15,23,42,.035),0 12px 30px rgba(15,23,42,.045);
}
.aqe-financial-chart::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background-image:linear-gradient(var(--aqe-chart-grid) 1px,transparent 1px),linear-gradient(90deg,var(--aqe-chart-grid) 1px,transparent 1px);
  background-size:40px 40px;mask-image:linear-gradient(to bottom,#000,transparent 92%);opacity:.5;
}
.aqe-financial-chart :where(canvas,svg){display:block;max-width:100%!important}
.aqe-financial-chart svg[data-aqe-responsive-chart]{width:100%!important;height:auto;min-height:180px;max-height:min(460px,58vh)}
.aqe-financial-chart canvas{width:100%!important;touch-action:pan-y pinch-zoom}
.aqe-financial-chart iframe{display:block;width:100%!important;max-width:100%;border:0}
.aqe-chart-scroll{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.aqe-chart-scroll>table{min-width:680px}
html[data-ui-profile] body .desk-head,
html[data-ui-profile] body .desk-head h3{color:var(--ink-invert,#F3F7FC)!important}
html[data-ui-profile] body .desk-head :is(.desk-eyebrow,.desk-stamp){color:var(--trade-ink,#DCE6F2)!important}

@media(max-width:700px){
  body{font-size:15px;line-height:1.55}
  body:has(.mobile-workspace-nav){padding-bottom:calc(70px + var(--aqe-safe-bottom))}
  :where(main,.wrap,.container,.shell,.page,.workspace){min-width:0;max-width:100%}
  :where(main,.container,.shell,.page):not(.no-responsive-gutter){padding-inline:var(--aqe-mobile-gutter)}
  :where(h1){font-size:clamp(25px,7.2vw,32px)!important;line-height:1.12!important;letter-spacing:-.035em!important}
  :where(h2){font-size:clamp(19px,5.5vw,24px)!important;line-height:1.2!important;letter-spacing:-.02em!important}
  :where(h3){font-size:clamp(16px,4.5vw,20px)!important;line-height:1.28!important}
  :where(p,li,dd,dt){line-height:1.68}
  :where(button,.btn,input,select,textarea,summary){min-height:44px}
  :where(.grid,.cards,.metrics,.kpis,.panel-grid,.chart-grid,.dashboard-grid){grid-template-columns:minmax(0,1fr)!important}
  :where(.card,.panel,.module,.section,.widget){min-width:0;max-width:100%;border-radius:14px}

  .aqe-financial-chart{border-radius:12px;box-shadow:0 1px 2px rgba(15,23,42,.04)}
  .aqe-financial-chart::before{background-size:28px 28px}
  .aqe-financial-chart svg[data-aqe-responsive-chart]{min-height:170px;max-height:310px}
  .aqe-financial-chart canvas{max-height:min(360px,48vh)}
  .aqe-chart-scroll{margin-inline:calc(var(--aqe-mobile-gutter) * -.35);padding-bottom:4px}

  /* One useful quote rail on mobile. The third-party tape remains accessible in details. */
  .exchange-tape>iframe,.exchange-tape>div:not(.exchange-native-tape),.exchange-tape>p.muted{display:none!important}
  .exchange-tape{min-height:49px;contain:layout paint}
  .exchange-native-tape{scrollbar-width:none;min-height:49px;background:var(--aqe-navy-900,#08131F)}
  .exchange-native-tape::-webkit-scrollbar{display:none}
  .exchange-native-tape a{padding:9px 14px!important;font-size:11px!important;line-height:1.35}
  .exchange-tape details{padding:7px var(--aqe-mobile-gutter)!important;background:var(--aqe-n-25,#FBFCFE);border-top:1px solid var(--aqe-n-200,#E0E6EF)}
  .exchange-tape details:not([open])>*:not(summary){display:none}

  /* App header: identity first, account actions second, language compact. */
  body>header .bar{min-height:70px!important;padding:10px var(--aqe-mobile-gutter)!important;gap:8px!important}
  body>header .logo{flex:0 0 auto!important;min-width:58px!important}
  body>header .locale-control{margin-left:auto!important;flex:0 0 auto!important}
  body>header .locale-control select{height:40px!important;min-height:40px!important;padding:6px 28px 6px 10px!important;font-size:13px!important}
  html[data-ui-profile] body>header .customer-access-cluster{flex:0 0 auto!important;max-width:none!important}
  html[data-ui-profile] body>header .customer-access-actions{display:grid!important;grid-template-columns:minmax(48px,1fr) minmax(78px,1.35fr)!important;gap:5px!important;align-items:center;flex-wrap:nowrap!important}
  html[data-ui-profile] body>header #customer-logout-status:empty{display:none!important}
  html[data-ui-profile] body>header .customer-access-button{min-width:0!important;min-height:40px!important;height:40px!important;padding:7px 10px!important;font-size:13px!important;white-space:nowrap!important}
  html[data-ui-profile] body>header #customer-register-entry{min-height:40px!important;padding:7px 9px!important;font-size:13px!important}

  /* Main workspace and charts. */
  #desktop-workspace{padding:18px var(--aqe-mobile-gutter) calc(82px + var(--aqe-safe-bottom))!important}
  #desktop-workspace .workspace-head{gap:10px!important;margin-bottom:14px!important}
  #desktop-workspace :where(.workspace-tabs,.paper-console-tabs,.tfbar,.exchange-workflow){gap:7px!important;overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;flex-wrap:nowrap!important;padding-bottom:4px}
  #desktop-workspace :where(.workspace-tabs,.paper-console-tabs,.tfbar,.exchange-workflow)::-webkit-scrollbar{display:none}
  #desktop-workspace :where(.workspace-tabs,.paper-console-tabs,.tfbar,.exchange-workflow)>*{flex:0 0 auto;scroll-snap-align:start}
  #desktop-workspace :where(.card,.panel,.decision-desk,.model-observatory,.research-workbench){padding:14px!important}
  #desktop-workspace :where(.model-pro-chart,.observatory-chart,.desk-chart,.chartbox,.chart-wrap){min-width:0!important;max-width:100%!important}
  #desktop-workspace .calculation-model-sidebar{max-height:240px!important;padding:12px!important}
  #desktop-workspace .calculation-model-content .model-pro-chart{height:230px!important;min-height:230px!important}
  #desktop-workspace .calculation-model-content .model-pro-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #desktop-workspace .factory-model-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #desktop-workspace .factory-model-table{font-size:11px}

  .mobile-workspace-nav{padding-bottom:var(--aqe-safe-bottom)!important;height:calc(64px + var(--aqe-safe-bottom))!important}
}

@media(max-width:380px){
  :root{--aqe-mobile-gutter:11px}
  html[data-ui-profile] body>header .customer-access-actions{grid-template-columns:minmax(44px,1fr) minmax(70px,1.35fr)!important}
  body>header .customer-access-button,body>header #customer-register-entry{padding-inline:8px!important;font-size:12px!important}
  .aqe-financial-chart svg[data-aqe-responsive-chart]{min-height:158px}
}

@media(orientation:landscape) and (max-height:520px){
  body{padding-bottom:8px}
  .mobile-workspace-nav{position:static!important;height:auto!important;padding-bottom:8px!important}
  .aqe-financial-chart svg[data-aqe-responsive-chart],.aqe-financial-chart canvas{max-height:72vh}
}

@media(prefers-reduced-motion:reduce){
  .aqe-financial-chart *{animation-duration:.001ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}
}
