/* Orizon Gestão V6.3.28 · Launch Stabilization
   Camada final: isolamento visual, responsividade real, acessibilidade e estados. */
:root{
  --ux28-deep:#06170f;--ux28-deep-2:#082519;--ux28-green:#087a4b;--ux28-green-dark:#055d39;
  --ux28-gold:#d5aa3a;--ux28-paper:#fff;--ux28-soft:#f5f8f6;--ux28-line:#d8e2dc;
  --ux28-text:#17271f;--ux28-muted:#65766d;--ux28-danger:#b94237;--ux28-focus:#2aa970;
  --ux28-top:76px;
}
html{scrollbar-gutter:stable;scroll-behavior:smooth}
body{overflow-x:hidden!important;background:var(--ux28-deep)!important}
:focus-visible{outline:3px solid color-mix(in srgb,var(--ux28-focus) 70%,white)!important;outline-offset:2px!important}
button,a,input,select,textarea,summary{scroll-margin-top:calc(var(--ux28-top) + 96px)}

/* Hierarquia sticky única: topbar > título > workspace. */
.topbar{z-index:110!important;top:0!important;margin-top:0!important}
.page-header{top:var(--ux25-topbar,var(--ux28-top))!important;z-index:90!important}
.workspace-dock{z-index:85!important}
.company-switch{position:relative;z-index:112;min-width:0}
.company-switch select{max-width:min(430px,42vw)!important;text-overflow:ellipsis}

/* Estado da rota: a tela anterior nunca deve permanecer como conteúdo principal. */
#app[aria-busy="true"]{min-height:240px}
.view-loading{display:grid!important;gap:8px!important;align-content:center!important;min-height:180px!important;padding:28px!important;color:var(--ux28-muted)!important;background:linear-gradient(100deg,#fff 25%,#f2f6f3 40%,#fff 60%)!important;background-size:250% 100%!important;animation:ux28Skeleton 1.25s ease-in-out infinite!important}
.view-loading b{color:var(--ux28-text)!important;font-size:15px}.view-loading span{font-size:12px}
@keyframes ux28Skeleton{0%{background-position:100% 0}100%{background-position:-100% 0}}
.report-error-state,.report-empty-state{display:grid!important;justify-items:start!important;gap:8px!important;text-align:left!important}.report-empty-state a{margin-top:4px}

/* Scroll real e aparente. */
.table-wrap,.report-chart-scroll,.workspace-tab-scroll,.farm-tabs,.tabs{scrollbar-width:auto!important;scrollbar-color:#647b6f #e7eee9!important;overscroll-behavior:contain!important}
.table-wrap::-webkit-scrollbar,.report-chart-scroll::-webkit-scrollbar,.workspace-tab-scroll::-webkit-scrollbar,.farm-tabs::-webkit-scrollbar,.tabs::-webkit-scrollbar{width:13px!important;height:13px!important}
.table-wrap::-webkit-scrollbar-track,.report-chart-scroll::-webkit-scrollbar-track,.workspace-tab-scroll::-webkit-scrollbar-track,.farm-tabs::-webkit-scrollbar-track,.tabs::-webkit-scrollbar-track{background:#e7eee9!important;border-radius:999px!important}
.table-wrap::-webkit-scrollbar-thumb,.report-chart-scroll::-webkit-scrollbar-thumb,.workspace-tab-scroll::-webkit-scrollbar-thumb,.farm-tabs::-webkit-scrollbar-thumb,.tabs::-webkit-scrollbar-thumb{background:#647b6f!important;border:3px solid #e7eee9!important;border-radius:999px!important;min-width:42px!important}
.table-wrap::-webkit-scrollbar-thumb:hover{background:#3f5a4b!important}
thead th{position:sticky!important;top:0!important;z-index:15!important;background:#edf3ef!important}

/* Densidade operacional sem cardões vazios. */
.card{padding:14px!important}.section-title{margin-bottom:8px!important}.grid{gap:9px!important}
.filters,.report-filters,.management-report-filters,.filter-card-compact{padding:10px 12px!important;gap:8px!important}
.field input,.field select,.field textarea{min-height:40px!important}
.empty{padding:16px!important}.note,.success,.danger-note{line-height:1.45!important}

/* Relatórios: filtros explícitos, KPIs auditáveis e menos ambiguidade. */
.active-filter-chips{display:flex;flex-wrap:wrap;gap:6px;margin:9px 0 2px;min-height:28px;align-items:center}
.filter-chip{display:inline-flex;align-items:center;gap:5px;border:1px solid #d9e4de;background:#f6f9f7;color:#52665b;border-radius:999px;padding:5px 8px;font-size:10px;line-height:1.2}
.filter-chip b{color:#174531}.filter-chip.muted{opacity:.72}
.report-kpi{min-width:0}.report-kpi-meta,.report-kpi-formula{display:block!important;margin-top:6px!important;color:#718179!important;font-size:9px!important;line-height:1.35!important;text-transform:none!important;letter-spacing:0!important}
.report-kpi-formula{padding-top:5px;border-top:1px dashed #e1e8e4}
.management-report-filters{grid-template-columns:repeat(4,minmax(150px,1fr))!important}
.report-actions{margin-top:10px!important}

/* Tabelas densas: identidade fixa; ações secundárias não dominam a linha. */
.table-wrap table{min-width:max-content}
.table-wrap td,.table-wrap th{max-width:360px}
.table-wrap td{overflow-wrap:anywhere}
.table-wrap td:first-child,.table-wrap th:first-child{position:sticky;left:0;z-index:12;background:#fff}
.table-wrap thead th:first-child{z-index:18;background:#edf3ef!important}
.table-wrap tbody tr:hover td:first-child{background:#f6faf7!important}

/* Oria ocupa zona segura e não cobre CTA/legenda. */
@media(min-width:1101px){
  main{padding-right:max(92px,2.7vw)!important;padding-bottom:118px!important}
  .orizon-ai-assistant{right:14px!important;bottom:18px!important}
}
@media(max-width:1100px){main{padding-bottom:132px!important}.orizon-ai-assistant{right:12px!important;bottom:92px!important}}

/* Mobile: empresa ativa visível, conteúdo acima da barra e Oria. */
@media(max-width:900px){
  :root{--ux28-top:68px}
  .topbar{display:flex!important;gap:8px!important;align-items:center!important}
  .topbar-mobile-brand{display:none!important}
  .company-switch{display:grid!important;flex:1 1 auto!important;min-width:0!important}
  .company-switch>span,.environment-badge{display:none!important}
  .company-switch-row,.company-switch select{width:100%!important;min-width:0!important;max-width:none!important}
  .company-switch select{height:42px!important;font-size:12px!important}
  .top-actions{flex:0 0 auto!important}.top-actions .mini-link,.top-actions .avatar,.top-actions .user-meta{display:none!important}
  .page-header{top:68px!important;padding:10px 2px!important;margin-top:-10px!important}
  .page-header h1{font-size:20px!important}.page-header p{font-size:10.5px!important;line-height:1.35!important}
  .workspace-dock{top:132px!important}
  main{padding-bottom:calc(156px + env(safe-area-inset-bottom))!important}
  .mobile-primary-nav{padding-bottom:env(safe-area-inset-bottom)!important;z-index:120!important}
  .orizon-ai-assistant{right:10px!important;bottom:calc(88px + env(safe-area-inset-bottom))!important;z-index:119!important}
  .orizon-ai-panel{inset:74px 8px calc(82px + env(safe-area-inset-bottom)) 8px!important;height:auto!important;max-height:none!important}
  .management-report-filters{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:700px){
  .management-report-filters{grid-template-columns:1fr!important}
  .report-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}.report-actions .primary{grid-column:1/-1}
  .report-kpis{grid-template-columns:1fr 1fr!important;padding:10px!important}.report-kpi{padding:10px!important}.report-kpi strong{font-size:18px!important}
  .report-cover{padding:16px!important;flex-direction:column!important}.report-cover h2{font-size:23px!important}.report-cover-meta{min-width:0!important;width:100%!important}
  .report-dashboard,.report-detail{padding:12px!important}
  .table-wrap{position:relative!important;max-width:100%!important;border-radius:10px!important}
  .table-wrap table{font-size:11px!important}.table-wrap th,.table-wrap td{padding:9px 10px!important}
  .table-wrap th:first-child,.table-wrap td:first-child{min-width:118px!important;max-width:160px!important;box-shadow:4px 0 8px rgba(7,31,19,.05)}
  .farm-table,.report-table,.purchase-process-table,.asset-table{min-width:760px!important}
}

/* Acessibilidade, zoom e preferência do usuário. */
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}.view-loading{animation:none!important;background:#f7faf8!important}*{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}}
@media(forced-colors:active){.badge,.filter-chip,.primary,.secondary{border:1px solid ButtonText!important}.orizon-ai-launcher{border:2px solid ButtonText!important}}
@media(min-resolution:1dppx){button,.primary,.secondary,.mini-link,.icon-btn{min-height:40px}}
@media(max-width:480px){button,.primary,.secondary,.mini-link,.icon-btn,summary{min-height:44px!important}}
