/* ASN System V4.8.6 — redesign estrutural do Dashboard.
   Mantém os IDs, RPCs e filtros originais; gráficos apenas com valores reais.
   Estilo inspirado na referência enviada: rubi, grafite, hierarquia executiva. */
html.asn-brand-v482[data-theme="dark"]{
 --bg-main:#090f17!important; --bg-secondary:#121b27!important;
 --bg-tertiary:#172332!important; --bg-elevated:#1b2938!important;
 --border:#2b3847!important; --text-main:#f6f8fc!important;
 --text-support:#b7c4d4!important; --text-muted:#96aabe!important;
 --accent:#f1324e!important; --accent-hover:#ff5168!important;
 --danger:#ff6975!important;
}
html.asn-brand-v482[data-theme="light"]{
 --accent:#b62036!important; --accent-hover:#9f1429!important;
 --text-main:#142033!important; --text-support:#526175!important;
 --border:#dce2e8!important;
}
html.asn-brand-v482[data-theme="dark"] body,
html.asn-brand-v482[data-theme="dark"] .main-content.dashboard-v34-shell{
 background:radial-gradient(ellipse 470px 230px at 75% 0,rgba(143,20,39,.14),transparent 75%),#0a1018!important;
}
/* Navegação real do ERP, não imagem: todas as páginas continuam com menus e permissões originais. */
html.asn-brand-v482 .asn-sidebar.sidebar{
 background:linear-gradient(180deg,#111821 0%,#0d151f 63%,#0b121b 100%)!important;
 border-right:1px solid #273544!important;
}
html.asn-brand-v482 .asn-nav-brand{height:90px!important}
html.asn-brand-v482 .asn-nav-mark{width:49px!important;height:49px!important;flex-basis:49px!important}
html.asn-brand-v482 .asn-nav-brand-text strong{font-size:18px!important}
html.asn-brand-v482 .asn-sidebar a.asn-nav-link,
html.asn-brand-v482 .asn-sidebar button.asn-nav-link{
 padding:10px 12px!important;min-height:39px!important;font-size:12.5px!important;
 border:1px solid transparent!important;border-radius:10px!important;
}
html.asn-brand-v482 .asn-sidebar a.asn-nav-link.active{
 background:linear-gradient(106deg,#95192a,#d82b44)!important;
 box-shadow:inset 0 0 0 1px rgba(255,155,168,.45),0 6px 21px rgba(182,24,43,.23)!important;
 border-color:rgba(247,108,128,.4)!important;color:#fff!important;
}
html.asn-brand-v482 .asn-sidebar .asn-nav-link .asn-nav-icon{font-size:16px!important;width:22px}
html.asn-brand-v482 .asn-nav-group{letter-spacing:.13em!important;font-size:9px!important}
/* Dashboard: nova barra de aplicação semelhante à referência, sem controles falsos. */
html.asn-brand-v482 .main-content.dashboard-v34-shell{padding:0 30px 54px!important}
.dashboard-v34{width:100%;max-width:1700px}
.asn-v486-utility{
 min-height:68px;display:flex;align-items:center;justify-content:space-between;
 gap:16px;border-bottom:1px solid var(--border);margin:0 -30px 24px;padding:10px 30px;
 background:rgba(9,15,23,.63);
}
.asn-v486-global-search{
 display:flex;align-items:center;gap:11px;width:min(450px,60%);
 border:1px solid #334357;background:#121d2a;border-radius:11px;padding:0 14px;min-height:42px;
}
.asn-v486-search-icon{color:#b9c6d7;font-size:26px;line-height:1}
#asn-v486-search{border:0!important;outline:0!important;box-shadow:none!important;background:transparent!important;
 color:#f5f7fb!important;font:500 12px/1.5 Inter,'Segoe UI',system-ui,sans-serif!important;min-width:0;width:100%;padding:9px 0}
#asn-v486-search::placeholder{color:#b0bfce!important;opacity:1}
.asn-v486-global-search:focus-within{border-color:#f0667d;box-shadow:0 0 0 3px rgba(218,48,72,.16)}
.asn-v486-search-hint{white-space:nowrap;color:#9aabbc;font-size:9px}
.asn-v486-utility-right{display:flex;align-items:center;gap:24px}
.asn-v486-live{display:flex;align-items:center;gap:6px;color:#b9c9d7;font-size:10px;white-space:nowrap}
.asn-v486-live-dot{width:7px;height:7px;border-radius:50%;background:#3ab996}
.asn-v486-identity{display:flex;align-items:center;gap:10px;min-width:136px;border-left:1px solid #334052;padding-left:20px}
.asn-v486-avatar{display:grid;place-items:center;flex:0 0 32px;height:32px;border-radius:50%;background:#642335;color:#fff;font-weight:900}
.asn-v486-identity strong{display:block;color:#f3f6fc;font-size:11px}
.asn-v486-identity small{display:block;color:#9eafc1;font-size:10px;max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:3px}
html.asn-brand-v482 .dashboard-v34 .v34-topbar{align-items:center;margin-bottom:16px;gap:20px}
.dashboard-v34 .v34-eyebrow{letter-spacing:.09em;font-size:10px;color:#e98c9a!important}
.dashboard-v34 .v34-topbar h1{font-size:clamp(28px,2.6vw,37px)!important;line-height:1.14;letter-spacing:-.038em;font-weight:850}
.asn-v486-headline-sub{margin:7px 0 0;color:var(--text-support);font-size:13px;line-height:1.5}
.dashboard-v34 .v34-date{font-size:11px;line-height:1.4;color:var(--text-support);margin:3px 0 0}
.dashboard-v34 .v34-header-actions{gap:8px}
.dashboard-v34 .v34-btn,.dashboard-v34 .v34-theme-btn{border-radius:10px!important;min-height:37px!important;font-size:11px!important;padding:0 13px!important}
/* Painel de filtros: todos os campos originais e quatro atalhos realmente acionam seus scripts. */
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .v34-filterbar,
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .v34-panel,
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .v34-kpi{
 background:linear-gradient(150deg,#121c28 0%,#101923 100%)!important;
 border:1px solid #2c3949!important;
 border-radius:15px!important;
 box-shadow:0 4px 18px rgba(0,0,0,.1)!important;
}
.dashboard-v34 .v34-filterbar{padding:17px 18px 13px!important;margin-bottom:19px!important}
.dashboard-v34 .v34-filter-main{grid-template-columns:minmax(220px,1.35fr) minmax(185px,.9fr) minmax(180px,1fr) minmax(250px,1.15fr)!important;gap:12px!important;align-items:end}
.dashboard-v34 .v34-filterbar .filter-group>label{color:#c5d1df!important;font-size:10px!important;font-weight:750!important;margin-bottom:3px}
.dashboard-v34 .v34-filterbar :is(.filter-input,.asn-month-apply-v460){min-height:40px;border-radius:8px!important}
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .filter-input{
 color:#f1f5fb!important;background:#0e1722!important;border:1px solid #34475c!important;
}
.dashboard-v34 .v34-platform-pills{flex-wrap:wrap;gap:5px;min-height:40px}
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .v34-platform-pills label{background:#162333;color:#dbe4f0!important;border-color:#36465a;border-radius:8px;padding:5px 8px;font-size:11px!important}
.dashboard-v34 .v34-platform-pills input{accent-color:#ec334e}
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .v34-platform-pills label:has(input:checked){background:#35202c!important;border-color:#be3b50!important}
.dashboard-v34 .asn-dashboard-tools-v458{margin-top:15px;padding-top:12px;border-top:1px solid #2d3b4b;gap:7px}
.dashboard-v34 .asn-dashboard-tools-title{color:var(--text-support);font-size:11px}
.dashboard-v34 .asn-dashboard-tools-v458 button{border-radius:8px!important;padding:9px 12px!important;min-height:37px!important;font-size:11px!important}
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .asn-dashboard-tools-v458 button{
 color:#e7edf6;background:#172231;border:1px solid #344253}
html.asn-brand-v482[data-theme="dark"] .dashboard-v34 .asn-dashboard-tools-v458 button[aria-pressed="true"]{
 background:linear-gradient(110deg,#ad182e,#e02b46)!important;color:#fff!important;border-color:#ef4c63!important}
html.asn-brand-v482 .dashboard-v34 #asn-dash-refresh-v458{
 background:linear-gradient(110deg,#a8132b,#df2a45)!important;color:#fff!important;border:1px solid #ef536c!important;
 margin-left:4px;font-weight:850!important;box-shadow:0 2px 12px rgba(215,36,63,.12)}
.dashboard-v34 #asn-dashboard-updated-v458,.dashboard-v34 #asn-dash-period-confirm-v461{
 flex:1 1 100%;width:100%;margin:0!important;font-size:10px!important;line-height:1.55;color:var(--text-support)}
.dashboard-v34 #asn-dashboard-updated-v458{color:#d1dfed}
/* KPIs: typografia, hierarquia e ícones rubi; resultados seguem o Supabase. */
.asn-v486-section-label{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin:15px 0 10px}
.asn-v486-section-label>span{color:var(--text-main);font-size:12px;font-weight:850;letter-spacing:.025em}
.asn-v486-section-label>small{color:var(--text-support);font-size:10px}
.dashboard-v34 .v34-kpi-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:11px;margin-bottom:19px}
.dashboard-v34 .v34-kpi{min-height:148px!important;padding:14px 13px!important;display:flex;flex-direction:column;justify-content:flex-start}
.dashboard-v34 .v34-kpi::after{content:none!important}
.dashboard-v34 .v34-kpi::before{content:"";position:absolute;left:0;bottom:0;right:0;height:2px;
 background:linear-gradient(90deg,transparent 0%,rgba(228,47,70,.45) 65%,transparent 100%);pointer-events:none}
html.asn-brand-v482 .dashboard-v34 .v34-kpi-icon{
 width:37px!important;height:37px!important;border-radius:10px!important;flex:0 0 37px;
 background:linear-gradient(130deg,#ae1830,#e1324c)!important;color:#fff!important;
 font-size:16px!important;box-shadow:0 5px 16px rgba(176,29,49,.2);margin-bottom:12px!important}
.dashboard-v34 .v34-kpi-label{font-size:10px!important;letter-spacing:.025em!important;color:#beccda!important;font-weight:800!important}
.dashboard-v34 .v34-kpi-value{color:var(--text-main)!important;font-size:clamp(16px,1.55vw,24px)!important;letter-spacing:-.04em;line-height:1.17;white-space:normal;overflow-wrap:anywhere}
.dashboard-v34 .v34-kpi-profit .v34-kpi-value{color:#f6f8fc!important}
.dashboard-v34 .v34-kpi-note{font-size:10px!important;line-height:1.42;margin-top:7px;white-space:normal;max-height:2.85em;overflow:hidden;color:#a6b8ca!important}
.dashboard-v34 .v34-kpi-alert .v34-kpi-value{color:#f8fafd!important}
.dashboard-v34 .asn-prejuizo-v458 .v34-kpi-value{color:#ff8593!important}
/* Charts use the two REAL datasets available: product ranking + cost breakdown. */
.dashboard-v34 .asn-v486-charts-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,.95fr);gap:14px;margin-bottom:14px}
.dashboard-v34 .asn-v486-chart-card{min-width:0;min-height:316px;padding:19px 20px 12px!important;display:flex;flex-direction:column}
.asn-v486-chart-header{display:flex;align-items:center;gap:11px;margin-bottom:11px}
.asn-v486-graph-icon{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,#a81931,#cb3049);display:grid;place-items:center;color:white;font-weight:900;font-size:18px;flex:0 0 38px}
.asn-v486-chart-header h2{font-size:14px!important;font-weight:850;margin:0 0 3px!important;color:var(--text-main)}
.asn-v486-chart-header p,.asn-v486-panel-hint{font-size:10.5px;color:var(--text-support);line-height:1.5;margin:0}
.dashboard-v34 .asn-v486-chart-card .v34-bar-wrap{height:238px!important;margin:0!important;flex:1}
.dashboard-v34 .asn-v486-chart-card .v34-donut-wrap{height:242px!important;margin:0!important;flex:1}
/* Lower row: cost tiles vs ranking table, not a blank stretched border. */
.dashboard-v34 .v34-main-grid{display:grid;grid-template-columns:minmax(0,1.03fr) minmax(0,.97fr);gap:14px;align-items:start;margin-bottom:16px}
.dashboard-v34 .v34-main-grid>.v34-panel{height:auto!important;min-height:0!important;align-self:start;overflow:hidden;padding:19px 18px!important}
.dashboard-v34 .v34-panel-head{gap:11px;align-items:center;margin-bottom:15px}
.dashboard-v34 .v34-panel-kicker{font-size:9px;color:#e68a98!important;letter-spacing:.11em}
.dashboard-v34 .v34-panel h2{font-size:15px;color:var(--text-main);font-weight:850}
.dashboard-v34 .v34-total-cost span{font-size:10px}
.dashboard-v34 .v34-total-cost strong{font-size:14px;color:#f7f8fb!important}
.dashboard-v34 .v34-financial-content{display:block!important}
.dashboard-v34 .v34-breakdown-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.dashboard-v34 .v34-breakdown-item{min-height:72px;padding:12px 13px;background:#1a2635;border:1px solid #304052;border-radius:10px}
.dashboard-v34 .v34-breakdown-item span{color:#b2c2d3;font-size:10px;line-height:1.35}
.dashboard-v34 .v34-breakdown-item strong{color:#f4f7fc;font-size:15px;font-weight:850}
.dashboard-v34 .v34-top-panel .v34-compact-table-wrap{border:0;overflow:visible}
.dashboard-v34 .v34-top-panel .v34-compact-table{min-width:0;width:100%;table-layout:fixed}
.dashboard-v34 .v34-top-panel .v34-compact-table th{font-size:9px;padding:10px 7px;background:#1b2735}
.dashboard-v34 .v34-top-panel .v34-compact-table td{font-size:10px;padding:12px 7px;line-height:1.5;overflow-wrap:anywhere;vertical-align:middle}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(1){width:8%}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(2){width:33%}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(3){width:17%}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(4){width:9%}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(5){width:17%}
.dashboard-v34 .v34-top-panel .v34-compact-table :is(td,th):nth-child(6){width:16%}
.dashboard-v34 .v34-operation-grid{align-items:start;gap:14px}
.dashboard-v34 .v34-operation-grid .v34-panel{padding:19px!important}
/* Clear interactive focus. No invisible text in dark mode. */
html.asn-brand-v482 .dashboard-v34 :is(button,a,input,select):focus-visible{outline:2px solid #ff738a!important;outline-offset:2px}
html.asn-brand-v482[data-theme="light"] .asn-v486-utility{background:#f9fbfd}
html.asn-brand-v482[data-theme="light"] .asn-v486-global-search{background:#fff;border-color:#d7e0ea}
html.asn-brand-v482[data-theme="light"] #asn-v486-search{color:#1b293b!important}
html.asn-brand-v482[data-theme="light"] #asn-v486-search::placeholder{color:#526175!important}
html.asn-brand-v482[data-theme="light"] .asn-v486-identity strong{color:#182332}
html.asn-brand-v482[data-theme="light"] .asn-v486-identity small,html.asn-brand-v482[data-theme="light"] .asn-v486-live{color:#526175}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-kpi-label{color:#56667a!important}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-kpi-value,html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-kpi-profit .v34-kpi-value{color:#172439!important}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-kpi-note{color:#637188!important}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-breakdown-item{background:#f5f7f9;border-color:#dce3ec}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-breakdown-item :is(span,strong){color:#1b293c}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-total-cost strong{color:#202c3c!important}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-panel-kicker{color:#a52339!important}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .asn-dashboard-tools-v458 button:not([aria-pressed="true"]){background:#f3f6fa;color:#26384e;border-color:#cfd8e4}
@media(max-width:1540px){
 .dashboard-v34 .v34-filter-main{grid-template-columns:1.2fr .85fr 1fr!important}
 .dashboard-v34 .v34-platform-filter{grid-column:1/-1}
}
@media(max-width:1230px){
 .dashboard-v34 .v34-kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .dashboard-v34 .asn-v486-charts-grid{grid-template-columns:1fr 1fr}
 .dashboard-v34 .v34-top-panel .v34-compact-table-wrap{overflow-x:auto}
 .dashboard-v34 .v34-top-panel .v34-compact-table{min-width:600px}
 .asn-v486-search-hint{display:none}
}
@media(max-width:1050px){
 .dashboard-v34 .asn-v486-charts-grid,.dashboard-v34 .v34-main-grid{grid-template-columns:1fr}
 .dashboard-v34 .v34-top-panel .v34-compact-table{min-width:0}
 .dashboard-v34 .v34-main-grid>.v34-panel{padding:16px!important}
}
@media(max-width:900px){
 html.asn-brand-v482 .main-content.dashboard-v34-shell{padding:0 16px 36px!important}
 .asn-v486-utility{margin:0 -16px 18px;padding:12px 70px 12px 16px}
 .asn-v486-live{display:none}
 .dashboard-v34 .v34-filter-main{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .dashboard-v34 .v34-platform-filter{grid-column:1/-1}
}
@media(max-width:650px){
 .asn-v486-utility{min-height:60px;padding:10px 14px 10px 65px;gap:8px}
 .asn-v486-global-search{width:100%;max-width:none;min-width:0;padding:0 9px}
 .asn-v486-identity{display:none}
 .dashboard-v34 .v34-topbar{flex-direction:column;align-items:flex-start!important;gap:12px}
 .dashboard-v34 .v34-header-actions{width:100%;justify-content:flex-start}
 .dashboard-v34 .v34-filter-main{grid-template-columns:1fr!important}
 .dashboard-v34 .v34-platform-filter{grid-column:auto}
 .dashboard-v34 .v34-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
 .dashboard-v34 .v34-kpi{min-height:148px!important;padding:12px!important}
 .dashboard-v34 .v34-kpi-value{font-size:20px!important}
 .dashboard-v34 .v34-top-panel .v34-compact-table-wrap{overflow-x:auto}
 .dashboard-v34 .v34-top-panel .v34-compact-table{min-width:560px}
 .dashboard-v34 .v34-breakdown-grid{grid-template-columns:1fr 1fr}
 .asn-v486-section-label{display:block}
 .asn-v486-section-label small{display:block;margin-top:3px}
}
@media(max-width:390px){.dashboard-v34 .v34-kpi-grid{grid-template-columns:1fr}}
/* Algumas folhas antigas forçam o cabeçalho para coluna mesmo em desktop.
   Fix explícito para seguir a hierarquia horizontal da referência. */
@media(min-width:901px){
 html.asn-brand-v482 .dashboard-v34 header.v34-topbar{
  display:flex!important;flex-direction:row!important;align-items:center!important;
  justify-content:space-between!important;text-align:left!important;width:100%!important;
 }
 html.asn-brand-v482 .dashboard-v34 header.v34-topbar>div:first-child{
  margin:0!important;text-align:left!important;flex:1 1 auto!important;min-width:0!important;
 }
 html.asn-brand-v482 .dashboard-v34 header.v34-topbar>.v34-header-actions{
  flex:0 0 auto!important;justify-content:flex-end!important;width:auto!important;margin:0!important;
 }
}
@media(max-width:900px){
 html.asn-brand-v482 .dashboard-v34 header.v34-topbar{
  display:flex!important;flex-direction:column!important;align-items:flex-start!important;text-align:left!important;
 }
}
html.asn-brand-v482 .dashboard-v34 .v34-btn-primary{
 background:linear-gradient(110deg,#a91c32,#db2d49)!important;
 color:#fff!important;border-color:#df526c!important;
}
html.asn-brand-v482 .dashboard-v34 .v34-header-actions .v34-btn-primary:visited,
html.asn-brand-v482 .dashboard-v34 .v34-header-actions .v34-btn-primary *{
 color:#fff!important;
}
.dashboard-v34 .v34-filter-main .filter-group>label{text-align:left!important}
/* Link de ação sobre fundo rubi: vence um seletor legado do tema que pinta
   TODOS os links da área principal de azul, inclusive botões vermelhos. */
html.asn-brand-v482[data-theme="dark"] body.asn-nav-ready .main-content.dashboard-v34-shell .dashboard-v34 .v34-header-actions a.v34-btn-primary,
html.asn-brand-v482[data-theme="light"] body.asn-nav-ready .main-content.dashboard-v34-shell .dashboard-v34 .v34-header-actions a.v34-btn-primary{
 color:#fff!important;-webkit-text-fill-color:#fff!important;
 background:linear-gradient(108deg,#a81530,#d62b47)!important;
 border:1px solid #dc4a62!important;text-decoration:none!important;
}
/* Legibilidade em modo claro: rótulos e carimbos do período não podem ficar apagados. */
html.asn-brand-v482[data-theme="light"] .dashboard-v34 .v34-filterbar .filter-group>label{
 color:#40536a!important;
}
html.asn-brand-v482[data-theme="light"] .dashboard-v34 #asn-dashboard-updated-v458,
html.asn-brand-v482[data-theme="light"] .dashboard-v34 #asn-dash-period-confirm-v461{
 color:#435770!important;
}
