/* QG 2026 — camada transversal de responsividade */
:root{--qg-touch:44px;--qg-safe-bottom:env(safe-area-inset-bottom,0px);--qg-safe-top:env(safe-area-inset-top,0px)}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}body{overflow-x:hidden}img,video,canvas,svg{max-width:100%;height:auto}button,a,input,select,textarea{font:inherit}button,a[role="button"],input[type="button"],input[type="submit"]{min-height:var(--qg-touch)}input,select,textarea{max-width:100%;font-size:16px}.qg-shell,.shell,.page,.wrap,.container{max-width:100%}.qg-bottom-nav,.bottom-nav,.bottomNav{padding-bottom:max(8px,var(--qg-safe-bottom))}.qg-topbar,.topbar,.header{padding-top:max(0px,var(--qg-safe-top))}
@media(max-width:430px){body{font-size:15px}.grid,.stats,.cards,.metric-grid{grid-template-columns:minmax(0,1fr)!important}.card,.panel,.qg-card{min-width:0}.qg-bottom-nav a,.bottom-nav a,.bottomNav a{min-width:0}.qg-bottom-nav .label,.bottom-nav .label,.bottomNav .label{font-size:11px}.actions,.btn-row,.button-row{flex-wrap:wrap}.actions>* ,.btn-row>* ,.button-row>*{max-width:100%}}
@media(max-width:360px){body{font-size:14px}.qg-bottom-nav .label,.bottom-nav .label,.bottomNav .label{font-size:10px}.card,.panel,.qg-card{padding-left:12px!important;padding-right:12px!important}}
@media(min-width:768px) and (max-width:1180px){.qg-shell,.shell,.page,.wrap,.container{width:min(100%,900px);margin-inline:auto}.grid,.cards,.metric-grid{gap:16px}}
@media(orientation:landscape) and (max-height:520px){.qg-bottom-nav,.bottom-nav,.bottomNav{position:sticky}.hero,.welcome,.intro{min-height:0!important}}
@media(hover:none) and (pointer:coarse){button,a[role="button"],.btn,.nav-item{min-height:44px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* QG RC23 FIX — tipografia móvel e conteúdo sem esmagamento */
@media(max-width:430px){
  h1,h2,h3,.title,.card-title{overflow-wrap:normal;word-break:normal;hyphens:none}
  p,.muted,.desc,.description{overflow-wrap:break-word;word-break:normal}
  .card,.panel,.qg-card,.eco-panel{min-width:0!important}
  .card p,.panel p,.qg-card p,.eco-panel p{min-width:0!important;max-width:100%!important}
  a{overflow-wrap:break-word}
}


/* QG RC23.2 — tipografia e links student-facing */
.eco-page main a:not(.back):not(.eco-cta):not(.eco-row):not(.qg-performance-link):not(.qhr-mini),
.qg-2026 main a:not(.back):not(.btn),
.profile-v62 main a{color:inherit;text-decoration:none}
.eco-panel p a,.eco-panel p a:visited{color:#e5ba37!important;text-decoration:none!important;border-bottom:1px solid rgba(229,186,55,.32);font-weight:750}
.eco-panel p a:active{opacity:.78}
.settings-disabled{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:14px!important}.settings-disabled>div{min-width:0!important}.settings-disabled h3,.settings-disabled p{width:auto!important;max-width:none!important;word-break:normal!important;overflow-wrap:normal!important;hyphens:none!important}.settings-disabled p{white-space:normal!important;line-height:1.45!important}
.profile-v62 .list .row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:14px!important;align-items:center!important}.profile-v62 .list .row>div{min-width:0!important}.profile-v62 .list .row h3{font-size:18px!important;line-height:1.15!important}.profile-v62 .list .row p{font-size:13px!important;line-height:1.45!important;max-width:100%!important;word-break:normal!important;overflow-wrap:normal!important}
.discipline-bar b,.rend-row span,#assuntos p{word-break:normal!important;overflow-wrap:normal!important;text-transform:none!important}
.qg-cast-filters,.cast-tabs,.filter-row{overflow-x:auto!important;flex-wrap:nowrap!important;-webkit-overflow-scrolling:touch;scrollbar-width:none}.qg-cast-filters::-webkit-scrollbar,.cast-tabs::-webkit-scrollbar,.filter-row::-webkit-scrollbar{display:none}.qg-cast-filters>*,.cast-tabs>*,.filter-row>*{flex:0 0 auto!important;white-space:nowrap!important}
@media(max-width:430px){
  .eco-hero h2{font-size:clamp(28px,8.7vw,38px)!important;line-height:1.03!important;letter-spacing:-.03em}.eco-hero p{font-size:15px!important;line-height:1.5!important}.eco-panel h3{font-size:21px!important;line-height:1.15!important}.eco-panel p{font-size:14px!important;line-height:1.48!important}.eco-panel .label,.kicker{font-size:10px!important;letter-spacing:.16em!important}
  .profile-v62 .profile-tools{grid-template-columns:repeat(2,minmax(0,1fr))!important}.profile-v62 .profile-tools .card{min-width:0!important}.profile-v62 .profile-tools b{font-size:17px!important;line-height:1.15!important}.profile-v62 .profile-tools span{font-size:13px!important;line-height:1.42!important}
  .settings-disabled h3{font-size:19px!important}.settings-disabled p{font-size:13px!important}
}

/* QG release mobile guard */
@media(max-width:700px){body,html{max-width:100%;overflow-x:hidden}main,.app,.eco-app,.command-app,.office-app{max-width:100%!important;min-width:0!important;overflow-x:hidden}.grid,.cards,.dashboard-grid,.commercial-grid,.office-grid,[class*="grid"]{grid-template-columns:minmax(0,1fr)!important;max-width:100%!important}.card,article,section{min-width:0;max-width:100%;box-sizing:border-box}table{display:block;max-width:100%;overflow-x:auto}pre,.mono{white-space:pre-wrap;overflow-wrap:anywhere}}
\n/* QG P0 compactação oficial iPhone */
@media(max-width:540px){
 .command-section{padding:10px!important}.command-section>header{margin-bottom:8px!important}
 .command-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:6px!important}
 .command-grid a{min-height:118px!important;padding:9px 6px 9px!important;display:flex!important;flex-direction:column!important;align-items:flex-start!important;grid-template-columns:none!important;grid-template-rows:none!important}
 .command-grid i{width:30px!important;height:30px!important;margin:0 0 8px!important}.command-grid b{font-size:10.5px!important;line-height:1.05!important;margin-top:auto!important}.command-grid span{font-size:7.5px!important;line-height:1.15!important}.command-grid a:after{right:5px!important;bottom:8px!important;transform:none!important;font-size:18px!important}
 .phase-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}.phase-card{min-height:128px!important;padding:11px!important;display:flex!important;flex-direction:column!important;align-items:flex-start!important}.phase-card .phase-icon{width:34px!important;height:34px!important;margin:0 0 9px!important}.phase-card b{font-size:13px!important}.phase-card span{font-size:9px!important}.phase-card small{margin-top:auto!important}
}
.qg-continue-compact{margin:10px 0 12px;padding:12px;border:1px solid #28312d;border-radius:18px;background:#080c0a}.qg-continue-title{display:flex;gap:10px;align-items:center;margin-bottom:10px;letter-spacing:.13em;font-size:12px}.qg-continue-title i{width:5px;height:28px;border-radius:5px;background:#e5b936}.qg-continue-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.qg-continue-grid a{position:relative;min-width:0;min-height:112px;padding:9px 6px;border:1px solid #2b332f;border-radius:13px;color:#f4f4f0;text-decoration:none;display:flex;flex-direction:column}.qg-continue-grid a>span{font-size:24px;color:#35dfb0}.qg-continue-grid a.red>span{color:#ef5a55}.qg-continue-grid a.blue>span{color:#55bfe9}.qg-continue-grid b{font-size:10.5px;line-height:1.05;margin-top:auto}.qg-continue-grid small{font-size:7.5px;color:#8f9892;margin-top:5px}.qg-continue-grid a:after{content:'›';position:absolute;right:5px;bottom:8px;color:#7d8580;font-size:18px}
/* RC26 P0: nenhuma tela rolável fica sob o dock/safe-area no iPhone */
body:has(.academy), body:has(.academy-shell), body:has(.eco-app), body:has(.enlist){padding-bottom:calc(118px + env(safe-area-inset-bottom,0px))!important}
.academy,.academy-shell,.eco-app,.enlist{padding-bottom:calc(128px + env(safe-area-inset-bottom,0px))!important}

/* =========================================================
   QG RC40 — RESPONSIVIDADE ADAPTATIVA OFICIAL
   Mobile <=767 | Tablet 768–1199 | Desktop 1200–1599 | Wide >=1600
   Mantém identidade/fluxos; reorganiza composição por viewport.
   ========================================================= */
:root{--qg-content-max:1440px;--qg-desktop-rail:92px}
*{box-sizing:border-box}
html,body{width:100%;min-width:0}
body{min-height:100dvh}
main{min-width:0}
img,video,iframe,canvas{max-width:100%}
pre,code{max-width:100%;overflow-wrap:anywhere}
table{max-width:100%}

/* TABLET */
@media (min-width:768px) and (max-width:1199px){
  .command-shell{max-width:1040px!important;padding:24px 28px 120px!important}
  .command-order{min-height:520px!important}
  .command-order h1{font-size:clamp(38px,5vw,54px)!important}
  .command-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:12px!important}
  .qg-dock-unified{width:min(calc(100% - 48px),820px)!important;border-radius:22px 22px 0 0!important}
  .academy,.academy-shell,.eco-app,.eco-page main,.page,.wrap,.container,.shell{max-width:1040px;margin-inline:auto}
  .dashboard-grid,.office-grid,.commercial-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* DESKTOP: vira aplicação de computador, não telefone ampliado */
@media (min-width:1200px){
  body{padding-left:var(--qg-desktop-rail)!important;padding-bottom:0!important}
  body>main,.command-shell,.academy,.academy-shell,.eco-app,.office-app,.app,.page,.wrap,.container,.shell{
    width:min(calc(100% - 56px),var(--qg-content-max))!important;max-width:var(--qg-content-max)!important;margin-inline:auto!important;
  }
  .command-shell{padding:34px 34px 54px!important;display:grid!important;grid-template-columns:minmax(0,1.45fr) minmax(360px,.75fr)!important;column-gap:22px!important;align-items:start!important}
  .command-head,.qg-live-line,.command-status,.qg-exam-countdown,.command-order{grid-column:1}
  .command-brief,.command-now,.command-section,.command-radar,.command-evolution,.command-motto,.qg-card[href="radar-nacional.html"]{grid-column:2}
  .command-head{grid-row:1}.qg-live-line{grid-row:2}.command-status{grid-row:3}.qg-exam-countdown{grid-row:4}.command-order{grid-row:5 / span 8;margin-top:14px!important;min-height:650px!important}
  .command-brief{grid-row:1 / span 2;margin-top:4px!important}.command-now{grid-row:3 / span 2;margin-top:0!important}.command-section{grid-row:5;margin-top:14px!important}.command-radar{grid-row:6}.command-evolution{grid-row:7}.command-motto{grid-row:8}.qg-card[href="radar-nacional.html"]{grid-row:9}
  .command-order h1{font-size:clamp(48px,4.3vw,72px)!important;max-width:86%!important}.command-order p{max-width:72%!important;font-size:15px!important}.command-order-content{padding:28px!important}
  .command-status{gap:12px!important}.command-status .command-status-card{padding:15px!important}
  .command-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}.command-grid a{min-height:118px!important}

  /* Dock mobile torna-se rail lateral persistente */
  .qg-dock-unified,.qg-dock-unified.qg-dock-premium{
    position:fixed!important;left:0!important;top:0!important;bottom:0!important;transform:none!important;width:var(--qg-desktop-rail)!important;max-width:var(--qg-desktop-rail)!important;height:100dvh!important;
    display:flex!important;flex-direction:column!important;justify-content:center!important;align-items:stretch!important;gap:8px!important;padding:18px 8px!important;border-radius:0!important;border-right:1px solid rgba(224,187,73,.18)!important;border-top:0!important;background:rgba(5,7,6,.96)!important;
  }
  .qg-dock-unified>a,.qg-dock-unified.qg-dock-premium>a{width:100%!important;height:auto!important;min-height:76px!important;padding:9px 3px!important;display:flex!important;flex-direction:column!important;justify-content:center!important;align-items:center!important;border-radius:14px!important}
  .qg-dock-unified>a.active,.qg-dock-unified.qg-dock-premium>a.active{background:rgba(224,187,73,.08)!important}
  .qg-dock-unified>a.active:before,.qg-dock-unified.qg-dock-premium>a.active:before{left:-8px!important;top:50%!important;transform:translateY(-50%)!important;width:4px!important;height:34px!important}
  .qg-dock-unified .sinapse-tab .icon,.qg-dock-unified.qg-dock-premium .sinapse-tab .icon{margin:0!important;width:50px!important;height:50px!important}
  .qg-dock-unified>a label,.qg-dock-unified.qg-dock-premium>a label{font-size:10px!important;line-height:1.1!important;text-align:center!important}

  /* Grades e painéis desktop */
  .dashboard-grid,.office-grid,.commercial-grid,.cards,.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
  .profile-tools{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  .actions,.btn-row,.button-row{gap:12px}
  table{display:table;width:100%;overflow:visible}

  /* Folha de prova: documento central, sem aparência de telefone */
  .paper,.exam-paper,.question-paper,.qg-paper,[class*="paper-sheet"],[class*="exam-sheet"]{width:min(100%,920px)!important;max-width:920px!important;margin-inline:auto!important;padding:clamp(32px,4vw,64px)!important}
}

/* WIDE */
@media (min-width:1600px){
  :root{--qg-content-max:1540px;--qg-desktop-rail:104px}
  .command-shell{grid-template-columns:minmax(0,1.55fr) minmax(420px,.75fr)!important;column-gap:28px!important;padding-top:42px!important}
  .command-order{min-height:700px!important}.command-order h1{font-size:72px!important}
  .dashboard-grid,.office-grid,.commercial-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* Landscape baixo: preserva acesso e evita corte */
@media (orientation:landscape) and (max-height:600px) and (min-width:768px){
  .qg-dock-unified{overflow-y:auto!important}.command-order{min-height:420px!important}
}
/* RC52 acumulado — BUG008: dock nunca pode cobrir conteúdo no iPhone */
@media (max-width: 820px){
  body:has(.dock.qg-dock-unified), body:has(.qg-bottom-nav){padding-bottom:calc(118px + env(safe-area-inset-bottom))!important}
  main.eco-app:has(+ .dock.qg-dock-unified), main.eco-app:has(.qg-bottom-nav){padding-bottom:calc(118px + env(safe-area-inset-bottom))!important}
  .dock.qg-dock-unified,.qg-bottom-nav{bottom:0!important;padding-bottom:max(8px,env(safe-area-inset-bottom))!important}
}

/* QG 2026-09-16 · BUG 008.1 — dock iPhone calibrado */
@media(max-width:600px){
  .qg-bottom-nav,.bottom-nav,.bottomNav,.dock.qg-dock-unified{bottom:max(6px,calc(env(safe-area-inset-bottom) * .22))!important;padding-bottom:max(6px,calc(env(safe-area-inset-bottom) * .55))!important}
  body:has(.dock.qg-dock-unified),body:has(.qg-bottom-nav){padding-bottom:calc(112px + env(safe-area-inset-bottom))!important}
}

/* RC52 P0 · BUG014 — safe-area superior global sem ampliar desktop */
@media(max-width:820px){
  .command-shell{padding-top:calc(12px + env(safe-area-inset-top))!important}
  .eco-app>.eco-head:first-child,.qg-topbar,.topbar,.header{padding-top:calc(8px + env(safe-area-inset-top))!important}
  .eco-head[style*="sticky"],.eco-head{scroll-margin-top:env(safe-area-inset-top)}
}


/* QG P0 2026-09-25 — Android: restaura rolagem vertical nativa com 1 dedo.
   Escopo: superfícies estruturais; não altera layout, dock, botões ou fluxos.
   Mantém trilhos horizontais explicitamente pan-x. */
@media (hover:none) and (pointer:coarse){
  html,body,
  main,.app,.eco-app,.command-app,.office-app,
  .qg-shell,.shell,.page,.wrap,.container,
  .command-shell,.academy,.academy-shell,.enlist,
  .card,.panel,.qg-card,.eco-panel,article,section{
    touch-action:pan-y pinch-zoom!important;
    -webkit-overflow-scrolling:touch;
  }
  .qg-cast-filters,.cast-tabs,.filter-row,
  [data-qg-horizontal-scroll]{
    touch-action:pan-x pinch-zoom!important;
  }
  nav.dock.qg-dock-unified,
  nav.dock.qg-dock-5-official,
  .qg-bottom-nav,.bottom-nav,.bottomNav{
    touch-action:manipulation!important;
  }
}

/* QG P0 TABLET 2026-09-25 — composição adaptativa sem alterar mobile/desktop */
@media (min-width:768px) and (max-width:1199px){
  body{overflow-x:hidden!important}
  body>main,.command-shell,.academy,.academy-shell,.eco-app,.office-app,.app,.page,.wrap,.container,.shell{
    width:min(calc(100% - 32px),1040px)!important;max-width:1040px!important;margin-inline:auto!important;
  }
  .command-shell{padding:clamp(18px,3vw,30px) clamp(16px,3vw,32px) 126px!important}
  .command-head,.command-status,.command-order,.command-brief,.command-now,.command-section,.command-radar,.command-evolution,.command-motto{min-width:0!important;max-width:100%!important}
  .command-status{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important}
  .command-status-card{min-width:0!important;padding:12px!important}
  .command-order{min-height:clamp(430px,58vw,560px)!important}
  .command-order-content{padding:clamp(20px,3vw,30px)!important}
  .command-order h1{font-size:clamp(36px,5vw,54px)!important;max-width:88%!important}
  .command-order p{max-width:78%!important}
  .command-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important}
  .command-grid a{min-width:0!important;min-height:132px!important}
  .qg-dock-unified,.qg-dock-unified.qg-dock-premium,nav.dock.qg-dock-unified,nav.dock.qg-dock-5-official{
    left:50%!important;right:auto!important;transform:translateX(-50%)!important;width:min(calc(100% - 32px),860px)!important;max-width:860px!important;
  }
  .academy,.academy-shell,.eco-app,.office-app,.app,.page,.wrap,.container,.shell{padding-left:clamp(16px,2.5vw,28px);padding-right:clamp(16px,2.5vw,28px)}
  .dashboard-grid,.office-grid,.commercial-grid,.cards,.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:14px!important}
  table{max-width:100%!important;overflow-x:auto}
}
@media (min-width:768px) and (max-width:900px){
  .command-status{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .command-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .command-order h1{max-width:100%!important}
  .command-order p{max-width:92%!important}
}
@media (min-width:768px) and (max-width:1199px) and (orientation:landscape){
  .command-order{min-height:400px!important}
  .command-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}
}

/* QG NOTEBOOK — moldura comum para os fluxos principais e telas de estudo.
   Preserva o rail/dock oficial e deixa a rolagem vertical a cargo da página. */
@media (min-width:1200px) and (max-width:1599px) {
  html, body {
    width:100%;
    max-width:100%;
    min-width:0;
    overflow-x:hidden;
  }
  body {
    padding-left:var(--qg-desktop-rail,92px)!important;
    padding-right:0!important;
  }
  body > main,
  body > .app,
  body > .sim-central-shell,
  body > .eco-app,
  body > .academy,
  body > .academy-shell,
  body > .training-app {
    box-sizing:border-box!important;
    width:min(100%,1440px)!important;
    max-width:1440px!important;
    min-width:0!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }
  body > .app > *,
  body > .sim-central-shell > *,
  body > .eco-app > *,
  body > .training-app > *,
  .phone,
  .phone > #app,
  .academy-shell,
  .academy,
  .academy main {
    box-sizing:border-box;
    min-width:0!important;
    max-width:100%;
  }
  .phone,
  .phone > #app {
    width:100%;
  }
  .qg-home-boot,
  [data-qg-home-boot] {
    width:100vw;
    max-width:100vw;
    left:0;
    right:0;
  }
}
