/* ===== Royal Apps v3: vidro azul-escuro (padrão) e claro. Fica por último e só troca visual. ===== */
@view-transition{navigation:auto}
:root[data-theme="dark"]{
  --navy:#0E2A5C;--gold:#F2B72E;--solid:#101F49;--solid-2:#16295C;
  --bg:#0A1736;--surface:rgba(255,255,255,.075);--ink:#F4F6FF;--ink-2:rgba(236,240,255,.70);--muted:rgba(236,240,255,.48);
  --line:rgba(255,255,255,.14);--line-2:rgba(255,255,255,.07);
  --primary:#9DBCFF;--primary-hover:#C2D5FF;--primary-soft:rgba(157,188,255,.16);
  --ok:#4ADE9A;--ok-bg:rgba(74,222,154,.14);--warn:#FFC555;--warn-bg:rgba(255,197,85,.14);
  --g-hi:inset 0 1px 0 rgba(255,255,255,.20),0 14px 32px -22px rgba(0,0,0,.75);
  --g-card:linear-gradient(180deg,rgba(255,255,255,.115),rgba(255,255,255,.05));
  --shadow-hover:inset 0 1px 0 rgba(255,255,255,.28),0 18px 36px -20px rgba(0,0,0,.8);
  --focus:0 0 0 3px rgba(242,183,46,.38);--r-card:22px;--r-ctl:12px;color-scheme:dark;
}
:root[data-theme="light"]{
  --solid:#FFFFFF;--solid-2:#F3F6FC;--gold:#E6B93D;
  --bg:#EEF2FA;--surface:rgba(255,255,255,.78);--line:rgba(20,48,107,.12);--line-2:rgba(20,48,107,.06);
  --g-hi:inset 0 1px 0 rgba(255,255,255,.9),0 12px 28px -20px rgba(20,48,107,.35);
  --g-card:linear-gradient(180deg,rgba(255,255,255,.92),rgba(255,255,255,.70));
  --r-card:22px;--r-ctl:12px;color-scheme:light;
}
html[data-theme="dark"]{background:#07122E}
html[data-theme="dark"] body{background:
  radial-gradient(60% 55% at 12% -5%,rgba(40,92,196,.55) 0%,transparent 62%),
  radial-gradient(45% 40% at 100% 8%,rgba(22,74,160,.50) 0%,transparent 60%),
  radial-gradient(70% 55% at 62% 105%,rgba(20,62,140,.55) 0%,transparent 62%),#07122E;background-attachment:fixed}
html[data-theme="light"]{background:#EEF2FA}
html[data-theme="light"] body{background:
  radial-gradient(60% 55% at 10% -5%,rgba(120,160,235,.30) 0%,transparent 62%),
  radial-gradient(45% 40% at 100% 5%,rgba(242,183,46,.14) 0%,transparent 60%),#EEF2FA;background-attachment:fixed}

/* ---- textos que explicam o que cada coisa faz: saem das telas ---- */
.lede,.optsbar .rule,.optsbar .escinfo,#resSub,#pdesc,#pedDesc,#capSub,.pt>p,.ptop p,.ini-scr>p,.ini-crumb,p.vd-note:not([style]),.x3{display:none!important}
html[data-pg="index"] #resTitle,html[data-pg="compras"] #resTitle,html[data-pg="index"] .kpi .s{display:none!important}
.pagehead{margin-bottom:16px!important;align-items:center!important}
.reshead{margin:14px 0 12px!important;min-height:0}
.reshead:not(:has(button)):not(:has(h2:not([style*="none"]))){margin:0!important}
html[data-pg="index"] .reshead:not(:has(button)){display:none!important}

/* ---- superfícies de vidro ---- */
html[data-theme] .kpi,html[data-theme] .panel,html[data-theme] .optsbar,html[data-theme] .ini-scr,html[data-theme] .card,html[data-theme] .setgroup,html[data-theme] .gate-card{
  background:var(--g-card);border:1px solid var(--line);box-shadow:var(--g-hi);border-radius:var(--r-card)}
html[data-theme] .optsbar{padding:14px 16px}
html[data-theme] .kpi{padding:16px 18px}
html[data-theme] .ini-scr:hover{box-shadow:var(--shadow-hover)}
html[data-theme="dark"] .ini-hero{background:linear-gradient(120deg,rgba(60,110,220,.42),rgba(255,255,255,.06));border:1px solid var(--line);box-shadow:var(--g-hi)}
html[data-theme] .ini-area{box-shadow:inset 0 1px 0 rgba(255,255,255,.28),0 18px 34px -22px rgba(0,0,0,.7);border:1px solid rgba(255,255,255,.14)}
html[data-theme="dark"] .ini-today{background:var(--g-card);border-color:var(--line);box-shadow:var(--g-hi)}

/* ---- barras: menu, topo e barra de baixo ---- */
html[data-theme="dark"] .sidebar{background:linear-gradient(180deg,rgba(255,255,255,.085),rgba(255,255,255,.035));border-right:1px solid var(--line);-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px)}
html[data-theme="dark"] .appbar{background:rgba(9,20,50,.55);border-bottom:1px solid var(--line-2);-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4)}
html[data-theme="light"] .appbar{background:rgba(238,242,250,.7);-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4)}
html[data-theme="dark"] .tabbar{background:rgba(16,31,73,.72);border:1px solid var(--line);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 16px 40px -12px rgba(0,0,0,.7);-webkit-backdrop-filter:blur(24px) saturate(1.5);backdrop-filter:blur(24px) saturate(1.5)}
html[data-theme="light"] .tabbar{background:rgba(255,255,255,.72);-webkit-backdrop-filter:blur(24px) saturate(1.5);backdrop-filter:blur(24px) saturate(1.5)}


/* ---- o que fica por cima da página precisa de fundo fechado ---- */
html[data-theme="dark"] .fx-drawer,html[data-theme="dark"] .modal,html[data-theme="dark"] dialog,html[data-theme="dark"] .menu,html[data-theme="dark"] .pop,html[data-theme="dark"] .sb-fly,html[data-theme="dark"] .rail-fly,html[data-theme="dark"] .sheet,html[data-theme="dark"] .dd{
  background:rgba(16,31,73,.92);border-color:var(--line);-webkit-backdrop-filter:blur(28px) saturate(1.4);backdrop-filter:blur(28px) saturate(1.4);box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 30px 60px -20px rgba(0,0,0,.8)}
html[data-theme="dark"] thead th{background:rgba(18,35,82,.94)}
html[data-theme="dark"] select option{background:#101F49;color:#F4F6FF}
html[data-theme="dark"] .toast{background:rgba(22,41,92,.92);color:var(--ink);border:1px solid var(--line);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);border-radius:16px}

/* ---- controles ---- */
html[data-theme] input:not([type=checkbox]):not([type=radio]):not([type=range]),html[data-theme] select,html[data-theme] textarea{border-radius:var(--r-ctl);background-color:var(--surface);border-color:var(--line)}
html[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]),html[data-theme="dark"] select,html[data-theme="dark"] textarea{background-color:rgba(4,12,34,.35);color:var(--ink);box-shadow:inset 0 1px 2px rgba(0,0,0,.35)}
html[data-theme] button{border-radius:var(--r-ctl)}
html[data-theme="dark"] button:not(.primary):not(.link):not(.ini-area):not(.ini-scr):not([class*="l-b"]):not(.todas){border-color:var(--line)}
html[data-theme] button.primary{border-radius:999px;box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 10px 22px -12px rgba(242,183,46,.7);font-weight:600}
html[data-theme="dark"] button.primary{background:linear-gradient(180deg,#F7C64A,#E9A91F);border-color:transparent;color:#1A1408}
html[data-theme="light"] button.primary{box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 10px 22px -12px rgba(14,42,92,.6)}
@media (hover:hover){html[data-theme="dark"] button.primary:hover:not(:disabled){background:linear-gradient(180deg,#FBD369,#EFB535)}}
button,.ini-area,.ini-scr,a.sb-item,.tabbar a{-webkit-tap-highlight-color:transparent}
@media (prefers-reduced-motion:no-preference){
  button:not(:disabled):active,.ini-scr:active,.ini-area:active{transform:scale(.97);transition:transform .12s ease-out}
}

/* ---- abas ---- */
@media (min-width:761px){
  html[data-theme] .segtabs{position:relative;border-radius:999px;padding:4px;background:rgba(0,0,0,.18);border:1px solid var(--line);box-shadow:inset 0 1px 2px rgba(0,0,0,.25)}
  html[data-theme="light"] .segtabs{background:rgba(20,48,107,.06);box-shadow:none}
  html[data-theme] .segtabs button{border-radius:999px;position:relative;z-index:1;border:none!important}
  html[data-theme] .segtabs button[aria-selected=true]{background:rgba(255,255,255,.16);color:var(--ink);box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 6px 14px -8px rgba(0,0,0,.6)}
  html[data-theme="light"] .segtabs button[aria-selected=true]{background:#fff;color:var(--primary);box-shadow:0 4px 12px -6px rgba(20,48,107,.4)}
  html.ui3-pill .segtabs button[aria-selected=true]{background:none!important;box-shadow:none!important}
  .ui3-pill-el{position:absolute;z-index:0;border-radius:999px;background:rgba(255,255,255,.16);box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 6px 14px -8px rgba(0,0,0,.6);pointer-events:none;top:0;left:0;will-change:transform,width}
  html[data-theme="light"] .ui3-pill-el{background:#fff;box-shadow:0 4px 12px -6px rgba(20,48,107,.4)}
}
@media (max-width:760px){
  html[data-theme="dark"] .segtabs button{background:var(--surface);border-color:var(--line)}
  html[data-theme="dark"] .segtabs button[aria-selected=true]{background:rgba(255,255,255,.9);color:#0A1736;border-color:transparent}
}

/* ---- tabela ---- */
html[data-theme="dark"] tbody tr{border-color:var(--line-2)}
html[data-theme="dark"] tbody td{border-color:var(--line-2)}
@media (hover:hover){html[data-theme="dark"] tbody tr:hover>td{background-color:rgba(255,255,255,.045)}}
table td,table th{font-variant-numeric:tabular-nums}
/* situação: meio-termo entre o selo e o bloco de cor cheia */
html[data-theme] td.sitc{position:relative;z-index:0;background:none!important;color:color-mix(in srgb,var(--sc) 52%,#fff)!important;font-weight:600}
html[data-theme="light"] td.sitc{color:color-mix(in srgb,var(--sc) 70%,#000)!important}
html[data-theme] td.sitc{font-size:12px!important;padding:0 10px!important}
html[data-theme] td.sitc::before{content:"";position:absolute;inset:9px 3px;border-radius:999px;z-index:-1;background:color-mix(in srgb,var(--sc) 26%,transparent);border:1px solid color-mix(in srgb,var(--sc) 55%,transparent)}
html[data-theme="light"] td.sitc::before{background:color-mix(in srgb,var(--sc) 14%,#fff)}

/* ---- entrada das páginas ---- */
::view-transition-old(root),::view-transition-new(root){animation-duration:.22s}
@media (min-width:761px){.sidebar{view-transition-name:ra-menu}}
@media (max-width:760px){.tabbar{view-transition-name:ra-barra}}
@media (prefers-reduced-motion:reduce){::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}}

/* ---- celular: números em faixa que desliza, sem cortar valor ---- */
@media (max-width:760px){
  html[data-theme] .kpis{display:flex!important;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-inline:16px;gap:10px;margin-inline:-16px;padding:2px 16px 6px;scrollbar-width:none}
  html[data-theme] .kpis::-webkit-scrollbar{display:none}
  html[data-theme] .kpis>.kpi{flex:0 0 68%;scroll-snap-align:start;min-width:0;border-radius:18px;padding:14px}
  html[data-theme] .kpis>.kpi .v{white-space:nowrap}
}
/* ---- movimento (lib/ui3.js) ---- */

@media (max-width:760px){
  html[data-theme] .segtabs{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto;gap:8px;scrollbar-width:none;max-width:100%}
  html[data-theme] .segtabs::-webkit-scrollbar{display:none}
  html[data-theme] .segtabs>button{flex:0 0 auto;white-space:nowrap}
}
/* ---- 17/11 (2): Curva e Situação do Giro/Compras/Reposição também viram pílula; menos espaço vazio ---- */
html[data-theme] td:has(>.chip:only-child){background:none!important;text-align:center;vertical-align:middle}
html[data-theme] td>.chip:only-child{--c:#9AA3B2;display:inline-block;padding:3px 11px!important;border-radius:999px!important;font-size:12px!important;font-weight:600;min-width:30px;
  background:color-mix(in srgb,var(--c) 24%,transparent)!important;border:1px solid color-mix(in srgb,var(--c) 52%,transparent);color:color-mix(in srgb,var(--c) 52%,#fff)!important}
html[data-theme="light"] td>.chip:only-child{background:color-mix(in srgb,var(--c) 14%,#fff)!important;color:color-mix(in srgb,var(--c) 70%,#000)!important}
td>.chip.A,td>.chip.gira,td>.chip.ab-A,td>.chip.ped{--c:var(--s-green)!important}
td>.chip.B,td>.chip.ab-B,td>.chip.loja,td>.chip.trf,td>.chip.saz{--c:var(--s-blue)!important}
td>.chip.C,td>.chip.ab-C,td>.chip.excesso,td>.chip.sm{--c:var(--s-orange)!important}
td>.chip.parado,td>.chip.urg{--c:var(--s-red)!important}
td>.chip.link{--c:var(--s-purple)!important}
html[data-theme] td.sitc::before{inset:auto 3px!important;top:50%!important;height:26px;transform:translateY(-50%)}
html[data-theme] #res{margin-top:12px!important}
html[data-theme] .reshead{margin:0 0 12px!important}
html[data-theme="dark"] tfoot td,html[data-theme="dark"] tfoot th{background:rgba(18,35,82,.97)!important}
html[data-theme="light"] tfoot td,html[data-theme="light"] tfoot th{background:#fff!important}
/* ---- 17/11 (3): submenu legível, lista de lojas, painel de Filtros, Início com cartões iguais ---- */
html[data-theme="dark"] .rl-fly{background:#14275C!important;border:1px solid rgba(255,255,255,.16);border-radius:16px;padding:10px;box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 28px 56px -18px rgba(0,0,0,.85)}
html[data-theme="light"] .rl-fly{background:#fff!important;border-radius:16px;padding:10px;box-shadow:0 24px 48px -18px rgba(20,48,107,.35)}
html[data-theme] .rl-fly button{border-radius:10px;padding:10px 12px}
html[data-theme="dark"] .rl-fly b{color:rgba(236,240,255,.55)}
@media (hover:hover){html[data-theme="dark"] .rl-fly button:hover{background:rgba(255,255,255,.09)}}
html[data-theme="dark"] .rl-fly button[aria-selected=true]{background:rgba(255,255,255,.13)}
html[data-theme="dark"] .rl-fly button[aria-selected=true] svg{color:var(--gold)}
html[data-theme="dark"] select optgroup{background:#0A1736;color:#F2B72E;font-weight:700;font-style:normal}
html[data-theme="dark"] select option{background:#14275C;color:#F4F6FF;font-weight:400}
html[data-theme="dark"] select option:checked{background:#2A4A9A;color:#fff}

html[data-theme] .fx-scrim{background:rgba(3,8,24,.55);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
html[data-theme] .fx-drawer{top:12px;right:12px;bottom:12px;width:min(420px,calc(100% - 24px));border-radius:26px;border:1px solid var(--line);overflow:hidden}
html[data-theme="dark"] .fx-drawer{background:rgba(17,33,78,.94)!important}
html[data-theme="light"] .fx-drawer{background:rgba(255,255,255,.96)!important;box-shadow:0 30px 60px -20px rgba(20,48,107,.45)}
html[data-theme] .fx-head{padding:20px 20px 14px}
html[data-theme] .fx-head h2{font-size:21px;font-weight:700}
html[data-theme] .fx-head button{width:36px;height:36px;min-height:0;padding:0;border-radius:50%!important;display:grid;place-items:center;font-size:20px;background:rgba(255,255,255,.08);border:1px solid var(--line)}
html[data-theme="light"] .fx-head button{background:rgba(20,48,107,.06)}
html[data-theme] .fx-body{padding:2px 16px 12px}
html[data-theme] .fx-row{padding:14px 16px;margin-top:8px;border:1px solid var(--line-2)!important;border-radius:14px!important;background:rgba(255,255,255,.055);font-weight:500}
html[data-theme="light"] .fx-row{background:rgba(20,48,107,.04)}
html[data-theme] .fx-row[aria-expanded=true]{background:rgba(255,255,255,.11);border-color:var(--line)!important}
html[data-theme="light"] .fx-row[aria-expanded=true]{background:rgba(20,48,107,.08)}
html[data-theme] .fx-val{color:var(--gold);font-weight:600}
html[data-theme="light"] .fx-val{color:var(--primary)}
html[data-theme] .fx-box{padding:10px 4px 6px}
html[data-theme] .fx-foot{display:grid!important;grid-template-columns:1fr 1fr;gap:10px;padding:14px 16px 16px;border-top:1px solid var(--line-2)}
html[data-theme] .fx-foot button{min-height:46px!important;border-radius:999px!important;font-size:15px;font-weight:600;justify-content:center;flex:none}
html[data-theme="dark"] .fx-foot button:not(.primary){background:rgba(255,255,255,.08);border:1px solid var(--line);color:var(--ink)}
html[data-theme] .fx-opc button,html[data-theme] .fx-sel button{border-radius:999px!important}
html[data-theme="dark"] .fx-opc button[aria-pressed=true]{background:var(--gold);color:#1A1408;border-color:transparent}
html[data-theme="dark"] .fx-res{background:rgba(4,12,34,.35)}
@media (prefers-reduced-motion:no-preference){
  .fx-drawer:not([hidden]){animation:ui3-painel .32s cubic-bezier(.32,.72,0,1)}
  .fx-scrim:not([hidden]){animation:ui3-fundo .2s ease-out}
}
@keyframes ui3-painel{from{transform:translateX(28px);opacity:0}to{transform:none;opacity:1}}
@keyframes ui3-fundo{from{opacity:0}to{opacity:1}}
@media (max-width:760px){
  html[data-theme] .fx-drawer{top:auto;left:8px;right:8px;bottom:8px;width:auto;max-height:86vh;border-radius:26px}
  @keyframes ui3-painel{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
}

html[data-theme] .ini-area .spark,html[data-theme] .ini-area .sl{display:none!important}
html[data-theme] .ini-areas{grid-auto-rows:1fr}
html[data-theme] .ini-area{min-height:158px}
/* ---- 17/11 (4): lista de escolha própria no computador ---- */
.ui3-sel{position:fixed;z-index:9999;display:flex;flex-direction:column;max-width:min(460px,calc(100vw - 16px));padding:8px;border-radius:16px;font:500 14px/1.3 var(--f-body);
  background:#14275C;color:#F4F6FF;border:1px solid rgba(255,255,255,.16);box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 28px 56px -18px rgba(0,0,0,.85);transform-origin:top left}
.ui3-sel.cima{transform-origin:bottom left}
html[data-theme="light"] .ui3-sel{background:#fff;color:#1E2240;border-color:rgba(20,48,107,.12);box-shadow:0 24px 48px -18px rgba(20,48,107,.4),0 2px 6px rgba(20,48,107,.08)}
@media (prefers-reduced-motion:no-preference){.ui3-sel{animation:ui3-lista .16s cubic-bezier(.23,1,.32,1)}}
@keyframes ui3-lista{from{opacity:0;transform:scale(.97) translateY(-4px)}to{opacity:1;transform:none}}
.ui3-sel-l{overflow:auto;overscroll-behavior:contain;min-height:0;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.25) transparent}
html[data-theme="light"] .ui3-sel-l{scrollbar-color:rgba(20,48,107,.25) transparent}
.ui3-sel .ui3-sel-q{width:100%;margin:0 0 8px;min-height:38px;padding:0 12px;border-radius:10px!important;font-size:14px}
.ui3-sel-g{padding:10px 12px 4px;font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:#F2B72E}
html[data-theme="light"] .ui3-sel-g{color:#1D4E9E}
.ui3-sel-g[hidden],.ui3-sel-it[hidden]{display:none!important}
.ui3-sel .ui3-sel-it{display:flex;align-items:center;justify-content:space-between;gap:14px;width:100%;min-height:0;padding:9px 12px;border:0!important;border-radius:10px!important;background:none;color:inherit;font:inherit;text-align:left;white-space:nowrap;transform:none!important;box-shadow:none}
.ui3-sel .ui3-sel-it.dentro{padding-left:20px}
.ui3-sel .ui3-sel-it.at{background:rgba(255,255,255,.10)}
html[data-theme="light"] .ui3-sel .ui3-sel-it.at{background:rgba(20,48,107,.07)}
.ui3-sel .ui3-sel-it.sel{font-weight:700}
.ui3-sel .ui3-sel-it.sel::after{content:"";flex:none;width:6px;height:11px;border:solid #F2B72E;border-width:0 2px 2px 0;transform:rotate(45deg);margin:-3px 4px 0 0}
html[data-theme="light"] .ui3-sel .ui3-sel-it.sel::after{border-color:#1D4E9E}
.ui3-sel .ui3-sel-it:disabled{opacity:.4}
select.ui3-sel-on{border-color:var(--gold)!important;box-shadow:var(--focus)}
/* ---- 17/11 (5): celular — a lista não fica dentro de caixa (era assim antes); cartões das linhas em vidro ---- */
@media (max-width:760px){
  html[data-theme] .panel{background:none!important;border:0!important;box-shadow:none!important;border-radius:0!important;overflow:visible!important}
  html[data-theme] .ptop{padding:0 0 12px!important;border:0!important}
}
/* tudo que abre por cima da tela precisa de fundo fechado (antes herdava o vidro transparente) */
html[data-theme] .gate,html[data-theme] .selbar,html[data-theme] .ct-act,html[data-theme] .ax-menu,html[data-theme] .ax-env em,html[data-theme] .cx-ficha,html[data-theme] .cx-inbox.chat.ficha .cx-ficha{background:var(--solid)!important}
html[data-theme="dark"] .cx-ficha{border-left:1px solid var(--line)}
@media (max-width:760px){
  html[data-theme] .cx-inbox.chat .cx-chat{background:var(--solid)!important}
  html[data-theme="dark"] .cx-inbox.chat .cx-chat{background:#0C1A3F!important}
  html[data-theme] input[type=date],html[data-theme] input[type=month],html[data-theme] input[type=time]{-webkit-appearance:none;appearance:none;display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box;text-align:left}
  html[data-theme] input[type=date]::-webkit-date-and-time-value{text-align:left}
  html[data-theme] .optsbar>*{min-width:0;max-width:100%}
  html[data-theme] .tabbar{padding:6px!important;gap:2px;overflow:hidden;box-sizing:border-box}
  html[data-theme] .tabbar button{border-radius:18px!important;min-width:0}
}
