/* Nexor 360 v206 — Produção — layout homologado HML-015 */
/* HML-005 estável: apenas apresentação/posicionamento do seletor já existente do v159 */
#ordersUnified .unified-orders-toolbar-v137{display:flex!important;align-items:center!important;gap:10px!important;flex-wrap:wrap!important}
#ordersUnified .orders-search-v147{flex:1 1 320px!important;min-width:240px!important}
#ordersViewToggleV159{display:inline-flex!important;align-items:center!important;flex:0 0 190px!important;width:190px!important;min-height:38px!important;padding:3px!important;border:1px solid var(--line)!important;border-radius:10px!important;background:#f5f7fb!important;overflow:visible!important}
#ordersViewToggleV159 button{display:block!important;visibility:visible!important;opacity:1!important;flex:1 1 50%!important;width:50%!important;min-width:0!important;height:32px!important;padding:0 10px!important;border:0!important;border-radius:8px!important;background:transparent!important;color:var(--muted)!important;font-weight:800!important;cursor:pointer!important;white-space:nowrap!important}
#ordersViewToggleV159 button.active{background:#ed1c24!important;color:#fff!important;box-shadow:0 4px 12px rgba(237,28,36,.2)!important}
#ordersUnified .unified-new-actions-v137{display:flex!important;gap:8px!important;flex-wrap:wrap!important;margin-left:auto!important}
#ordersUnified .unified-orders-filters-v137{display:grid!important;grid-template-columns:repeat(4,minmax(180px,1fr))!important;gap:8px!important;width:100%!important}
#ordersUnified .unified-orders-filters-v137>#ordersViewToggleV159{display:none!important}
@media(max-width:1100px){#ordersUnified .unified-orders-filters-v137{grid-template-columns:repeat(2,minmax(180px,1fr))!important}#ordersUnified .unified-new-actions-v137{margin-left:0!important;width:100%!important}}
@media(max-width:700px){#ordersUnified .unified-orders-filters-v137{grid-template-columns:1fr!important}#ordersViewToggleV159{flex-basis:100%!important;width:100%!important;max-width:240px!important}}

/* Nexor 360 HML-006 — Lista/Kanban, Dashboard Back Office e permissões */
#ordersUnified .unified-orders-toolbar-v137{
  display:grid!important;
  grid-template-columns:auto minmax(320px,1fr) auto!important;
  align-items:center!important;
  gap:12px!important;
}
#ordersUnified .hml006-order-main-controls{display:flex!important;align-items:center!important;gap:8px!important;min-width:0!important}
#ordersUnified .hml006-order-main-controls .orders-search-v147{display:grid!important;grid-template-columns:minmax(220px,1fr) 104px!important;gap:7px!important;flex:1 1 auto!important;min-width:280px!important;max-width:none!important}
#ordersUnified .hml006-order-main-controls .orders-search-v147 input{width:100%!important;min-width:0!important}
#ordersUnified #ordersViewToggleV159{display:grid!important;grid-template-columns:1fr 1fr!important;width:166px!important;min-width:166px!important;max-width:166px!important;height:34px!important;min-height:34px!important;padding:2px!important;overflow:visible!important;visibility:visible!important;opacity:1!important;flex:0 0 166px!important}
#ordersUnified #ordersViewToggleV159 button{display:flex!important;align-items:center!important;justify-content:center!important;width:auto!important;min-width:0!important;max-width:none!important;height:30px!important;min-height:30px!important;padding:4px 9px!important;white-space:nowrap!important;overflow:visible!important;visibility:visible!important;opacity:1!important}
#ordersUnified #ordersViewToggleV159 button.active{background:#ed1c24!important;color:#fff!important}
#ordersUnified .unified-new-actions-v137{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:7px!important;flex-wrap:nowrap!important}
#ordersUnified .unified-orders-filters-v137{grid-template-columns:repeat(4,minmax(145px,1fr))!important}
#ordersUnified .unified-orders-filters-v137 > .orders-search-v147,
#ordersUnified .unified-orders-filters-v137 > #ordersViewToggleV159{display:none!important}

.hml006-bo-dashboard{display:grid;gap:14px}
.hml006-bo-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:4px 2px 2px}
.hml006-bo-head h2{margin:0;font-size:24px}.hml006-bo-head p{margin:4px 0 0;color:var(--muted)}
.hml006-bo-stamp{font-size:12px;color:var(--muted);white-space:nowrap}
.hml006-bo-kpis{display:grid;grid-template-columns:repeat(6,minmax(130px,1fr));gap:10px}
.hml006-bo-kpi{border:1px solid var(--line);border-radius:14px;background:var(--panel);padding:13px;min-width:0;box-shadow:0 4px 14px rgba(20,40,80,.04)}
.hml006-bo-kpi small{display:block;color:var(--muted);font-weight:700;min-height:30px}.hml006-bo-kpi b{display:block;font-size:25px;margin-top:3px}.hml006-bo-kpi em{font-style:normal;font-size:11px;color:var(--muted)}
.hml006-bo-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.hml006-bo-panel{border:1px solid var(--line);border-radius:14px;background:var(--panel);overflow:hidden;min-width:0}
.hml006-bo-panel.wide{grid-column:1/-1}.hml006-bo-panel-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:13px 14px;border-bottom:1px solid var(--line)}
.hml006-bo-panel-head h3{margin:0;font-size:15px}.hml006-bo-panel-head small{color:var(--muted)}
.hml006-bo-tablewrap{overflow:auto}.hml006-bo-table{width:100%;border-collapse:collapse;font-size:12px}.hml006-bo-table th,.hml006-bo-table td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}.hml006-bo-table th{font-size:10px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);background:rgba(127,127,127,.04)}
.hml006-bo-table tr:last-child td{border-bottom:0}.hml006-bo-row{cursor:pointer}.hml006-bo-row:hover{background:rgba(237,28,36,.04)}
.hml006-age{display:inline-flex;align-items:center;gap:6px;font-weight:800}.hml006-age:before{content:'';width:8px;height:8px;border-radius:50%;background:#19a25b}.hml006-age.warn:before{background:#f0a300}.hml006-age.late:before{background:#ed1c24}.hml006-age.late{color:#b4232c}
.hml006-stage-list{display:grid;gap:7px;padding:12px}.hml006-stage{display:grid;grid-template-columns:minmax(130px,1fr) 48px 76px;align-items:center;gap:8px;border:1px solid var(--line);border-radius:10px;padding:9px 10px;background:rgba(127,127,127,.025);cursor:pointer;text-align:left;color:inherit}.hml006-stage b{overflow:hidden;text-overflow:ellipsis}.hml006-stage span{text-align:center;font-weight:800}.hml006-stage em{text-align:right;font-style:normal;font-size:11px;color:var(--muted)}
.hml006-empty{padding:22px;text-align:center;color:var(--muted)}
.hml006-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-weight:800;font-size:10px;background:#eef1f7;color:#4b5563}.hml006-badge.overdue{background:#fee2e2;color:#b91c1c}
@media(max-width:1450px){#ordersUnified .unified-orders-toolbar-v137{grid-template-columns:1fr!important}#ordersUnified .unified-new-actions-v137{justify-content:flex-start!important;flex-wrap:wrap!important}.hml006-bo-kpis{grid-template-columns:repeat(3,1fr)}}
@media(max-width:900px){#ordersUnified .hml006-order-main-controls{flex-wrap:wrap!important}#ordersUnified .hml006-order-main-controls .orders-search-v147{min-width:100%!important}.hml006-bo-grid{grid-template-columns:1fr}.hml006-bo-kpis{grid-template-columns:repeat(2,1fr)}.hml006-bo-panel.wide{grid-column:auto}}

/* HML-008: pessoal operacional não acessa Relatórios/Configurações */
html.hml008-operational #nav button[data-view="reports"],html.hml008-operational #nav button[data-view="settings"],html.hml008-operational button[data-view="reports"],html.hml008-operational button[data-view="settings"]{display:none!important;}

/* Nexor 360 HML-007 V2 — Cabeçalho compacto de Pedidos
   IMPORTANTE: somente CSS; não move nós do DOM durante o carregamento. */
#ordersUnified .unified-orders-toolbar-v137{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  flex-wrap:wrap!important;
  padding-bottom:0!important;
}
#ordersUnified .unified-orders-toolbar-v137 > div:first-child{
  flex:0 0 100%!important;
  width:100%!important;
}
#ordersUnified .unified-orders-toolbar-v137 > div:first-child h2{margin:0 0 4px!important}

/* Estrutura criada pelo HML-006: busca + Lista/Kanban. Mantemos intacta. */
#ordersUnified .hml006-order-main-controls{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  flex:1 1 650px!important;
  min-width:520px!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147{
  display:grid!important;
  grid-template-columns:minmax(240px,1fr) 112px!important;
  gap:8px!important;
  flex:1 1 430px!important;
  min-width:350px!important;
  max-width:520px!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147 input,
#ordersUnified .hml006-order-main-controls .orders-search-v147 button,
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159,
#ordersUnified .unified-new-actions-v137 .btn{
  height:42px!important;
  min-height:42px!important;
  box-sizing:border-box!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  width:184px!important;
  min-width:184px!important;
  max-width:184px!important;
  padding:3px!important;
  flex:0 0 184px!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159 button{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  visibility:visible!important;
  opacity:1!important;
  height:34px!important;
  min-height:34px!important;
  padding:4px 10px!important;
}
#ordersUnified .unified-new-actions-v137{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  flex:0 1 auto!important;
  flex-wrap:nowrap!important;
  margin-left:auto!important;
  min-width:0!important;
}
#ordersUnified .unified-new-actions-v137 .btn{
  padding:0 16px!important;
  min-width:142px!important;
  white-space:nowrap!important;
}
#ordersUnified .unified-orders-filters-v137{
  margin-top:10px!important;
  gap:8px!important;
  grid-template-columns:repeat(4,minmax(145px,1fr))!important;
}

@media(max-width:1450px){
  #ordersUnified .hml006-order-main-controls{flex:1 1 100%!important}
  #ordersUnified .unified-new-actions-v137{margin-left:0!important;justify-content:flex-start!important}
}
@media(max-width:900px){
  #ordersUnified .hml006-order-main-controls{min-width:100%!important;flex-wrap:wrap!important}
  #ordersUnified .hml006-order-main-controls .orders-search-v147{min-width:100%!important;max-width:none!important}
  #ordersUnified .unified-new-actions-v137{width:100%!important;flex-wrap:wrap!important}
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:repeat(2,minmax(145px,1fr))!important}
}
@media(max-width:620px){
  #ordersUnified .hml006-order-main-controls .orders-search-v147{grid-template-columns:1fr 105px!important}
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:1fr!important}
}

/* Nexor 360 HML-009 — Interface compacta
   Somente CSS: não altera DOM, regras, permissões, dados ou eventos. */

/* ===== CABEÇALHO GLOBAL ===== */
.top.top-v171{
  grid-template-columns:minmax(250px,.72fr) minmax(300px,1fr) minmax(720px,1.75fr)!important;
  gap:12px!important;
  padding-top:14px!important;
  padding-bottom:14px!important;
}
.top-v171 .user-context{
  grid-template-rows:auto auto!important;
  gap:4px!important;
}
.user-context-top-v171{gap:7px!important;}
.user-state-v171{gap:5px!important;}
.user-state-v171 #syncStatus{font-size:9px!important;line-height:1.1!important;}
.user-state-v171 .auto-sync-badge-v162{
  min-height:24px!important;height:24px!important;padding:0 7px!important;font-size:9px!important;border-radius:8px!important;
}

/* Ações secundárias como links/controles leves na mesma linha. */
.top-v171 #topActions{width:100%!important;}
.top-v171 #topActions .remote-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:2px!important;
  flex-wrap:nowrap!important;
  width:100%!important;
  min-height:32px!important;
}
.top-v171 #topActions .remote-actions .btn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
  height:30px!important;
  min-height:30px!important;
  padding:0 10px!important;
  border:0!important;
  border-radius:7px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--text)!important;
  font-size:10px!important;
  font-weight:800!important;
  white-space:nowrap!important;
}
.top-v171 #topActions .remote-actions .btn:hover{
  background:rgba(237,28,36,.07)!important;
  color:#ed1c24!important;
}
.top-v171 #topActions .remote-actions .btn.danger{
  color:#b91c1c!important;
  background:rgba(185,28,28,.06)!important;
}
.top-v171 #topActions .remote-actions .install-app-v164>span{
  width:14px!important;height:14px!important;font-size:10px!important;
}

/* ===== PEDIDOS ===== */
#ordersUnified .unified-orders-panel-v137{gap:8px!important;}
#ordersUnified .unified-orders-toolbar-v137{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  flex-wrap:nowrap!important;
  width:100%!important;
  padding-bottom:0!important;
}
#ordersUnified .unified-orders-toolbar-v137>div:first-child{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:92px!important;
}
#ordersUnified .unified-orders-toolbar-v137>div:first-child h2{
  margin:0!important;
  font-size:21px!important;
  white-space:nowrap!important;
}
#ordersUnified .hml006-order-main-controls{
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
  flex:1 1 auto!important;
  min-width:0!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147{
  display:grid!important;
  grid-template-columns:minmax(260px,1fr) 102px!important;
  gap:7px!important;
  flex:1 1 390px!important;
  min-width:330px!important;
  max-width:500px!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147 input,
#ordersUnified .hml006-order-main-controls .orders-search-v147 button{
  height:38px!important;min-height:38px!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159{
  width:158px!important;min-width:158px!important;max-width:158px!important;
  height:38px!important;min-height:38px!important;
  padding:3px!important;
  flex:0 0 158px!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159 button{
  height:30px!important;min-height:30px!important;padding:3px 8px!important;font-size:11px!important;
}

/* Ações de criação ficam compactas, na mesma linha. */
#ordersUnified .unified-new-actions-v137{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:3px!important;
  flex-wrap:nowrap!important;
  flex:0 0 auto!important;
  margin-left:auto!important;
}
#ordersUnified .unified-new-actions-v137 .btn{
  width:auto!important;
  min-width:0!important;
  height:38px!important;
  min-height:38px!important;
  padding:0 11px!important;
  border-radius:8px!important;
  box-shadow:none!important;
  font-size:10px!important;
  white-space:nowrap!important;
}
#ordersUnified .unified-new-actions-v137 .btn.secondary{
  background:transparent!important;
  color:#ed1c24!important;
  border:1px solid rgba(237,28,36,.25)!important;
}

/* Filtros em uma linha, inclusive ordenação quando presente. */
#ordersUnified .unified-orders-filters-v137{
  display:grid!important;
  grid-template-columns:repeat(5,minmax(130px,1fr))!important;
  gap:7px!important;
  width:100%!important;
  margin-top:2px!important;
}
#ordersUnified .unified-orders-filters-v137 select{
  min-width:0!important;
  height:36px!important;
  min-height:36px!important;
  font-size:10px!important;
}
#ordersUnified .unified-orders-filters-v137>.orders-search-v147,
#ordersUnified .unified-orders-filters-v137>#ordersViewToggleV159{display:none!important;}
#ordersUnified .stagebar{margin-top:0!important;}

@media(max-width:1500px){
  .top.top-v171{grid-template-columns:minmax(230px,.7fr) minmax(270px,.9fr) minmax(620px,1.6fr)!important;}
  .top-v171 #topActions .remote-actions .btn{padding:0 7px!important;font-size:9px!important;}
  #ordersUnified .unified-orders-toolbar-v137{flex-wrap:wrap!important;}
  #ordersUnified .unified-orders-toolbar-v137>div:first-child{flex:0 0 100%!important;}
  #ordersUnified .hml006-order-main-controls{flex:1 1 650px!important;}
}
@media(max-width:1050px){
  .top.top-v171{grid-template-columns:1fr!important;}
  .top-v171 #topActions .remote-actions{justify-content:flex-start!important;overflow-x:auto!important;}
  #ordersUnified .hml006-order-main-controls{flex-wrap:wrap!important;min-width:100%!important;}
  #ordersUnified .hml006-order-main-controls .orders-search-v147{min-width:100%!important;max-width:none!important;}
  #ordersUnified .unified-new-actions-v137{width:100%!important;justify-content:flex-start!important;overflow-x:auto!important;}
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:repeat(2,minmax(140px,1fr))!important;}
}
@media(max-width:620px){
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:1fr!important;}
}

/* Nexor 360 HML-010 — Layout operacional compacto universal
   Somente apresentação: todos os perfis usam o mesmo cabeçalho compacto.
   Não altera regras de negócio, RLS, permissões ou eventos. */

/* ===== CABEÇALHO GLOBAL EM DUAS LINHAS =====
   Linha 1: título/subtítulo + status/notificações/perfil
   Linha 2: pesquisa + ações auxiliares
*/
.top.top-v171{
  display:grid!important;
  grid-template-columns:minmax(420px,1.05fr) minmax(720px,1.6fr)!important;
  grid-template-areas:
    "heading context"
    "search actions"!important;
  column-gap:18px!important;
  row-gap:8px!important;
  align-items:center!important;
  padding:12px 18px!important;
  min-height:0!important;
}
.top-v171>.top-heading{grid-area:heading!important;align-self:center!important;min-width:0!important;}
.top-v171>.top-heading h1{margin:0 0 2px!important;font-size:30px!important;line-height:1.03!important;}
.top-v171>.top-heading p{margin:0!important;font-size:13px!important;line-height:1.2!important;}
.top-v171>.global-search-wrap{grid-area:search!important;width:100%!important;min-width:0!important;margin:0!important;align-self:center!important;}
.top-v171 .global-search-control-v73{
  display:grid!important;
  grid-template-columns:minmax(260px,1fr) 112px!important;
  gap:8px!important;
  align-items:center!important;
  width:100%!important;
  max-width:640px!important;
}
.top-v171 .global-search-control-v73 input,
.top-v171 .global-search-control-v73 button{height:38px!important;min-height:38px!important;margin:0!important;}
.top-v171 .global-search-results{position:absolute!important;z-index:40!important;}

/* Faz o user-context participar diretamente do grid do cabeçalho. */
.top-v171>.user-context{display:contents!important;}
.top-v171 .user-context-top-v171{
  grid-area:context!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
}
.top-v171 .user-context-top-v171 .user-profile-chip{margin-left:4px!important;}
.top-v171 .user-state-v171{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
  flex-wrap:nowrap!important;
  min-width:0!important;
}
.top-v171 .user-state-v171 #syncStatus{font-size:9px!important;white-space:nowrap!important;}
.top-v171 .user-state-v171 .auto-sync-badge-v162{
  height:24px!important;min-height:24px!important;padding:0 7px!important;font-size:9px!important;
}

.top-v171 #topActions{
  grid-area:actions!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  align-self:center!important;
}
.top-v171 #topActions .remote-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:4px!important;
  flex-wrap:nowrap!important;
  width:100%!important;
  min-height:38px!important;
  overflow-x:auto!important;
  scrollbar-width:none!important;
}
.top-v171 #topActions .remote-actions::-webkit-scrollbar{display:none!important;}
.top-v171 #topActions .remote-actions .btn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
  height:36px!important;
  min-height:36px!important;
  padding:0 9px!important;
  border:0!important;
  border-radius:7px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--text)!important;
  font-size:10px!important;
  font-weight:800!important;
  white-space:nowrap!important;
}
.top-v171 #topActions .remote-actions .btn:hover{background:rgba(237,28,36,.07)!important;color:#ed1c24!important;}
.top-v171 #topActions .remote-actions .btn.danger{color:#b91c1c!important;background:rgba(185,28,28,.05)!important;}

/* ===== PEDIDOS ===== */
#ordersUnified .unified-orders-panel-v137{gap:7px!important;}
#ordersUnified .unified-orders-toolbar-v137{
  display:grid!important;
  grid-template-columns:auto minmax(460px,1fr) auto!important;
  grid-template-areas:"title controls create"!important;
  align-items:center!important;
  gap:10px!important;
  width:100%!important;
  padding:0!important;
  margin:0!important;
}
#ordersUnified .unified-orders-toolbar-v137>div:first-child{
  grid-area:title!important;
  width:auto!important;
  min-width:90px!important;
  margin:0!important;
}
#ordersUnified .unified-orders-toolbar-v137>div:first-child h2{margin:0!important;font-size:22px!important;white-space:nowrap!important;}
#ordersUnified .hml006-order-main-controls{
  grid-area:controls!important;
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
  min-width:0!important;
  width:100%!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147{
  display:grid!important;
  grid-template-columns:minmax(270px,1fr) 105px!important;
  gap:7px!important;
  flex:1 1 auto!important;
  min-width:370px!important;
  max-width:none!important;
  margin:0!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147 input,
#ordersUnified .hml006-order-main-controls .orders-search-v147 button{height:38px!important;min-height:38px!important;margin:0!important;}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159{
  width:156px!important;min-width:156px!important;max-width:156px!important;
  height:38px!important;min-height:38px!important;
  padding:3px!important;
  flex:0 0 156px!important;
  margin:0!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159 button{height:30px!important;min-height:30px!important;font-size:11px!important;}
#ordersUnified .unified-new-actions-v137{
  grid-area:create!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:5px!important;
  flex-wrap:nowrap!important;
  margin:0!important;
  width:auto!important;
}
#ordersUnified .unified-new-actions-v137 .btn{
  width:auto!important;
  min-width:0!important;
  height:38px!important;min-height:38px!important;
  padding:0 11px!important;
  border-radius:8px!important;
  box-shadow:none!important;
  font-size:10px!important;
  white-space:nowrap!important;
}

/* Todos os filtros em uma única linha. O seletor de ordenação deixa de existir visualmente;
   a ordenação passa a ser feita clicando nos cabeçalhos da tabela (recurso já existente). */
#ordersUnified .unified-orders-filters-v137{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(150px,1fr))!important;
  gap:7px!important;
  width:100%!important;
  margin:0!important;
  padding:0!important;
}
#ordersUnified .unified-orders-filters-v137 select{
  min-width:0!important;
  width:100%!important;
  height:36px!important;min-height:36px!important;
  margin:0!important;
  font-size:10px!important;
}
#ordersUnified #ordersUnifiedSortV146{display:none!important;}
#ordersUnified .unified-orders-filters-v137>.orders-search-v147,
#ordersUnified .unified-orders-filters-v137>#ordersViewToggleV159{display:none!important;}

/* Deixa explícito que a tabela pode ser ordenada clicando nas colunas. */
#ordersUnified table.v63-enhanced-table thead th:not(:has(input[type="checkbox"])){
  cursor:pointer!important;
  user-select:none!important;
}
#ordersUnified table.v63-enhanced-table thead th[data-v63-sort="asc"]::after{content:" ↑";font-weight:900;}
#ordersUnified table.v63-enhanced-table thead th[data-v63-sort="desc"]::after{content:" ↓";font-weight:900;}

/* Ganho real de área útil. */
#ordersUnified .stagebar{margin-top:0!important;}
#ordersUnified .tablewrap{margin-top:2px!important;}

@media(max-width:1450px){
  .top.top-v171{grid-template-columns:minmax(330px,.85fr) minmax(650px,1.45fr)!important;column-gap:12px!important;}
  .top-v171 #topActions .remote-actions .btn{padding:0 6px!important;font-size:9px!important;}
  #ordersUnified .unified-orders-toolbar-v137{grid-template-columns:auto minmax(420px,1fr) auto!important;gap:7px!important;}
  #ordersUnified .unified-new-actions-v137 .btn{padding:0 8px!important;font-size:9px!important;}
}
@media(max-width:1180px){
  .top.top-v171{
    grid-template-columns:1fr!important;
    grid-template-areas:"heading" "context" "search" "actions"!important;
  }
  .top-v171 .user-context-top-v171{justify-content:flex-start!important;}
  .top-v171 #topActions .remote-actions{justify-content:flex-start!important;}
  #ordersUnified .unified-orders-toolbar-v137{
    grid-template-columns:1fr!important;
    grid-template-areas:"title" "controls" "create"!important;
  }
  #ordersUnified .unified-new-actions-v137{justify-content:flex-start!important;overflow-x:auto!important;}
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:repeat(2,minmax(150px,1fr))!important;}
}
@media(max-width:680px){
  #ordersUnified .hml006-order-main-controls{flex-wrap:wrap!important;}
  #ordersUnified .hml006-order-main-controls .orders-search-v147{min-width:100%!important;}
  #ordersUnified .unified-orders-filters-v137{grid-template-columns:1fr!important;}
}

/* Nexor 360 HML-013 — layout final inspirado no mockup aprovado
   Escopo estritamente visual. Não altera eventos, permissões, regras de negócio, Supabase ou dados.
   Objetivo: transformar o cabeçalho superior no mesmo padrão visual do mockup aprovado,
   preservando a área de Pedidos que já havia sido validada. */

/* ============================
   CABEÇALHO GLOBAL — 2 FAIXAS
   ============================ */
.top.top-v171{
  display:grid!important;
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  grid-template-rows:64px 52px!important;
  column-gap:10px!important;
  row-gap:10px!important;
  align-items:center!important;
  padding:16px 20px 18px!important;
  min-height:0!important;
  overflow:visible!important;
  border-radius:18px!important;
}

/* Linha 1: título + subtítulo */
.top-v171>.top-heading{
  grid-column:1 / span 7!important;
  grid-row:1!important;
  align-self:center!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
}
.top-v171>.top-heading h1{
  margin:0 0 5px!important;
  font-size:31px!important;
  line-height:1!important;
  font-weight:850!important;
  letter-spacing:-.035em!important;
  color:var(--text)!important;
  white-space:nowrap!important;
}
.top-v171>.top-heading p{
  margin:0!important;
  font-size:11.5px!important;
  line-height:1.25!important;
  color:var(--muted)!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* user-context/topRow viram transparentes para seus filhos participarem do grid principal */
.top-v171>.user-context,
.top-v171 .user-context-top-v171{display:contents!important;}

/* Linha 1: sino + calendário + perfil no canto direito */
.top-v171 .notification-wrap{
  grid-column:9!important;
  grid-row:1!important;
  justify-self:end!important;
  align-self:center!important;
  margin:0!important;
}
.top-v171 .n82-calendar-button-wrap{
  grid-column:10!important;
  grid-row:1!important;
  justify-self:center!important;
  align-self:center!important;
  margin:0!important;
}
.top-v171 .notification-bell{
  width:50px!important;
  height:50px!important;
  min-width:50px!important;
  min-height:50px!important;
  border:1px solid var(--line)!important;
  border-radius:12px!important;
  background-color:var(--panel)!important;
  box-shadow:0 3px 10px rgba(15,23,42,.04)!important;
  display:grid!important;
  place-items:center!important;
  padding:0!important;
  margin:0!important;
  font-size:0!important;
  color:transparent!important;
  position:relative!important;
}
.top-v171 #notificationBellBtn{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  background-position:center!important;
}
.top-v171 #notificationBellBtn::after{
  content:""!important;
  position:absolute!important;
  right:8px!important;
  top:7px!important;
  width:6px!important;
  height:6px!important;
  border-radius:50%!important;
  background:#ed1c24!important;
  box-shadow:0 0 0 2px var(--panel)!important;
}
.top-v171 #notificationBellBtn .notification-count{
  position:absolute!important;
  right:-3px!important;
  top:-4px!important;
  min-width:17px!important;
  height:17px!important;
  padding:0 4px!important;
  font-size:8px!important;
  line-height:17px!important;
  color:#fff!important;
  background:#ed1c24!important;
  border-radius:999px!important;
  z-index:2!important;
}
.top-v171 #calendarButtonN82{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  background-position:center!important;
}
.top-v171 #calendarButtonN82::after{
  content:"17"!important;
  position:absolute!important;
  left:0!important;
  right:0!important;
  bottom:8px!important;
  text-align:center!important;
  color:#0f172a!important;
  font-size:8px!important;
  font-weight:900!important;
  line-height:1!important;
}
.top-v171 .user-profile-chip{
  grid-column:11 / span 2!important;
  grid-row:1!important;
  justify-self:end!important;
  align-self:center!important;
  position:relative!important;
  width:100%!important;
  max-width:280px!important;
  min-width:220px!important;
  height:52px!important;
  min-height:52px!important;
  margin:0!important;
  padding:6px 34px 6px 8px!important;
  border:1px solid var(--line)!important;
  border-radius:14px!important;
  background:var(--panel)!important;
  box-shadow:0 3px 10px rgba(15,23,42,.035)!important;
}
.top-v171 .user-profile-chip::after{
  content:"⌄"!important;
  position:absolute!important;
  right:13px!important;
  top:50%!important;
  transform:translateY(-52%)!important;
  font-size:18px!important;
  line-height:1!important;
  color:var(--text)!important;
}
.top-v171 .user-profile-chip .avatar{
  width:40px!important;
  height:40px!important;
  min-width:40px!important;
  min-height:40px!important;
  font-size:14px!important;
  font-weight:900!important;
}
.top-v171 .user-profile-chip b{font-size:12px!important;line-height:1.15!important;}
.top-v171 .user-profile-chip small{font-size:9.5px!important;line-height:1.15!important;}

/* Linha 2: filtro de campo + busca + botão */
.top-v171>.global-search-wrap{
  grid-column:1 / span 5!important;
  grid-row:2!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  align-self:center!important;
  position:relative!important;
}
.top-v171 .global-search-control-v73{
  display:grid!important;
  grid-template-columns:160px minmax(240px,1fr) 102px!important;
  gap:8px!important;
  width:100%!important;
  max-width:none!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  align-items:center!important;
}
.top-v171 .global-search-control-v73 .global-search-field-v129,
.top-v171 .global-search-control-v73 input,
.top-v171 .global-search-control-v73 button{
  width:100%!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  border-radius:10px!important;
  font-size:10.5px!important;
}
.top-v171 .global-search-control-v73 .global-search-field-v129{
  min-width:0!important;
  padding:0 12px!important;
  background:var(--panel)!important;
}
.top-v171 .global-search-control-v73 input{
  min-width:0!important;
  padding-left:39px!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  background-position:13px center!important;
  background-size:16px 16px!important;
}
.top-v171 .global-search-control-v73 button{
  padding:0 14px!important;
  font-weight:850!important;
  box-shadow:0 7px 16px rgba(237,28,36,.14)!important;
}
.top-v171 .global-search-wrap .global-search-results{top:49px!important;}

/* Linha 2: Online -> Versão -> Salvamento automático */
.top-v171 .user-state-v171{
  grid-column:6 / span 3!important;
  grid-row:2!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:7px!important;
  width:100%!important;
  min-width:0!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  padding:0 14px 0 0!important;
  border-right:1px solid var(--line)!important;
  white-space:nowrap!important;
}
.top-v171 .user-state-v171 #syncStatus{display:none!important;}
.top-v171 .user-state-v171 .remote-chip,
.top-v171 .user-state-v171 .build-version-badge-v135,
.top-v171 .user-state-v171 .auto-sync-badge-v162{
  height:36px!important;
  min-height:36px!important;
  margin:0!important;
  border:1px solid var(--line)!important;
  border-radius:9px!important;
  background:var(--panel)!important;
  box-shadow:none!important;
  font-size:9.5px!important;
  font-weight:800!important;
  padding:0 10px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
}
.top-v171 .user-state-v171 .remote-chip{order:1!important;}
.top-v171 .user-state-v171 .build-version-badge-v135{order:2!important;}
.top-v171 .user-state-v171 .auto-sync-badge-v162{
  order:3!important;
  min-width:150px!important;
}
.top-v171 .user-state-v171 .auto-sync-badge-v162::after{display:none!important;content:none!important;}

/* Linha 2: ações leves, alinhadas no mesmo eixo */
.top-v171 #topActions{
  grid-column:9 / span 4!important;
  grid-row:2!important;
  width:100%!important;
  min-width:0!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  align-self:center!important;
}
.top-v171 #topActions .remote-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:3px!important;
  flex-wrap:nowrap!important;
  width:100%!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  overflow:visible!important;
}
.top-v171 #topActions .remote-actions .btn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
  height:34px!important;
  min-height:34px!important;
  margin:0!important;
  padding:0 5px!important;
  border:0!important;
  border-radius:7px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--text)!important;
  font-size:8.6px!important;
  line-height:1!important;
  font-weight:800!important;
  white-space:nowrap!important;
  display:inline-flex!important;
  align-items:center!important;
  gap:4px!important;
}
.top-v171 #topActions .remote-actions .btn:hover{
  background:rgba(237,28,36,.055)!important;
  color:#ed1c24!important;
}
.top-v171 #topActions .remote-actions .btn.danger{color:#ed1c24!important;background:transparent!important;}
.top-v171 #topActions .remote-actions .install-app-v164>span{font-size:15px!important;line-height:1!important;}
.top-v171 #topActions button[onclick="toggleTheme()"]::before{content:"◔";font-size:15px;line-height:1;}
.top-v171 #topActions button[onclick="openMyAccount()"]::before{content:"♙";font-size:15px;line-height:1;}
.top-v171 #topActions button[onclick="reloadRemoteState()"]::before{content:"↻";font-size:15px;line-height:1;}
.top-v171 #topActions button[onclick="manualRemoteSync()"]::before{content:"⟳";font-size:15px;line-height:1;}
.top-v171 #topActions button[onclick="logoutSupabase()"]::before{content:"⇥";font-size:15px;line-height:1;}

/* ============================
   PEDIDOS — mantém a estrutura aprovada,
   apenas aproxima a pele do mockup final.
   ============================ */
#ordersUnified .unified-orders-panel-v137{
  border-radius:16px!important;
  box-shadow:0 7px 24px rgba(15,23,42,.045)!important;
}
#ordersUnified .unified-new-actions-v137 .btn{
  background:var(--panel)!important;
  color:#ed1c24!important;
  border:1px solid rgba(237,28,36,.45)!important;
  box-shadow:none!important;
  font-weight:800!important;
}
#ordersUnified .unified-new-actions-v137 .btn:hover{
  background:rgba(237,28,36,.05)!important;
  border-color:#ed1c24!important;
}
#ordersUnified #ordersViewToggleV159{
  background:#f8fafc!important;
  border:1px solid var(--line)!important;
  border-radius:9px!important;
}
#ordersUnified #ordersViewToggleV159 button{
  border:0!important;
  background:transparent!important;
  color:var(--muted)!important;
  box-shadow:none!important;
}
#ordersUnified #ordersViewToggleV159 button.active,
#ordersUnified #ordersViewToggleV159 button[aria-pressed="true"]{
  color:#ed1c24!important;
  background:#fff7f7!important;
  border:1px solid rgba(237,28,36,.45)!important;
  border-radius:7px!important;
}
#ordersUnified .tablewrap{
  border:1px solid var(--line)!important;
  border-radius:12px!important;
  overflow:auto!important;
  background:var(--panel)!important;
}
#ordersUnified table thead th{
  background:#fbfcfe!important;
  font-weight:850!important;
}
#ordersUnified table tbody tr:hover{background:rgba(15,23,42,.018)!important;}

/* ============================
   RESPONSIVIDADE
   ============================ */
@media(max-width:1660px){
  .top.top-v171{grid-template-rows:60px 50px!important;padding:14px 16px 16px!important;column-gap:7px!important;}
  .top-v171>.top-heading h1{font-size:28px!important;}
  .top-v171 .global-search-control-v73{grid-template-columns:145px minmax(210px,1fr) 94px!important;gap:6px!important;}
  .top-v171 .user-state-v171 .auto-sync-badge-v162{min-width:125px!important;padding:0 8px!important;font-size:8.8px!important;}
  .top-v171 .user-state-v171 .remote-chip,
  .top-v171 .user-state-v171 .build-version-badge-v135{padding:0 8px!important;font-size:8.8px!important;}
  .top-v171 #topActions .remote-actions .btn{padding:0 3px!important;font-size:8px!important;gap:3px!important;}
  .top-v171 .user-profile-chip{min-width:200px!important;max-width:245px!important;}
}

@media(max-width:1380px){
  .top.top-v171{
    grid-template-columns:repeat(12,minmax(0,1fr))!important;
    grid-template-rows:60px 46px 42px!important;
    row-gap:8px!important;
  }
  .top-v171>.top-heading{grid-column:1 / span 7!important;grid-row:1!important;}
  .top-v171 .notification-wrap{grid-column:9!important;grid-row:1!important;}
  .top-v171 .n82-calendar-button-wrap{grid-column:10!important;grid-row:1!important;}
  .top-v171 .user-profile-chip{grid-column:11 / span 2!important;grid-row:1!important;}
  .top-v171>.global-search-wrap{grid-column:1 / span 7!important;grid-row:2!important;}
  .top-v171 .user-state-v171{grid-column:8 / span 5!important;grid-row:2!important;border-right:0!important;justify-content:flex-end!important;padding-right:0!important;}
  .top-v171 #topActions{grid-column:1 / span 12!important;grid-row:3!important;}
  .top-v171 #topActions .remote-actions{justify-content:flex-end!important;}
}

@media(max-width:850px){
  .top.top-v171{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:10px!important;
  }
  .top-v171>.user-context,
  .top-v171 .user-context-top-v171{display:flex!important;align-items:center!important;gap:8px!important;flex-wrap:wrap!important;}
  .top-v171>.top-heading h1{font-size:25px!important;white-space:normal!important;}
  .top-v171>.top-heading p{white-space:normal!important;}
  .top-v171 .user-profile-chip{margin-left:auto!important;width:auto!important;min-width:190px!important;}
  .top-v171>.global-search-wrap{width:100%!important;}
  .top-v171 .global-search-control-v73{grid-template-columns:1fr 1fr!important;grid-template-rows:40px 40px!important;height:auto!important;}
  .top-v171 .global-search-control-v73 input{grid-column:1 / span 2!important;grid-row:1!important;}
  .top-v171 .global-search-control-v73 .global-search-field-v129{grid-column:1!important;grid-row:2!important;}
  .top-v171 .global-search-control-v73 button{grid-column:2!important;grid-row:2!important;}
  .top-v171 .user-state-v171{display:flex!important;justify-content:flex-start!important;border:0!important;padding:0!important;overflow-x:auto!important;}
  .top-v171 #topActions .remote-actions{justify-content:flex-start!important;overflow-x:auto!important;}
}


/* Nexor 360 v209 — ajustes visuais aprovados no HML-017 */
/* Nexor 360 HML-017 — ajustes visuais solicitados após HML-016.
   Somente camada visual: preserva lógica, dados, Supabase e estabilidade. */

/* ===== AÇÕES DO CABEÇALHO: mais legíveis ===== */
.top-v171 #topActions .remote-actions{
  gap:8px!important;
}
.top-v171 #topActions .remote-actions .btn{
  font-size:11.5px!important;
  line-height:1!important;
  font-weight:800!important;
  height:36px!important;
  min-height:36px!important;
  padding:0 7px!important;
  gap:5px!important;
  letter-spacing:0!important;
}
.top-v171 #topActions .remote-actions .install-app-v164>span{
  width:17px!important;
  height:17px!important;
  font-size:13px!important;
  line-height:17px!important;
}
.top-v171 #topActions button[onclick="toggleTheme()"]::before,
.top-v171 #topActions button[onclick="openMyAccount()"]::before,
.top-v171 #topActions button[onclick="reloadRemoteState()"]::before,
.top-v171 #topActions button[onclick="manualRemoteSync()"]::before,
.top-v171 #topActions button[onclick="logoutSupabase()"]::before{
  font-size:17px!important;
  line-height:1!important;
}

/* ===== PEDIDOS: barra principal em uma linha no desktop ===== */
#ordersUnified .unified-orders-toolbar-v137{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  flex-wrap:nowrap!important;
  width:100%!important;
}
#ordersUnified .unified-orders-toolbar-v137>div:first-child{
  flex:0 0 auto!important;
  min-width:105px!important;
}
#ordersUnified .hml006-order-main-controls{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  flex:0 1 auto!important;
  min-width:0!important;
}
/* Pesquisa aproximadamente metade do tamanho original. */
#ordersUnified .hml006-order-main-controls .orders-search-v147{
  display:grid!important;
  grid-template-columns:minmax(220px,1fr) 108px!important;
  gap:7px!important;
  flex:0 1 430px!important;
  width:430px!important;
  max-width:430px!important;
  min-width:330px!important;
}
#ordersUnified .hml006-order-main-controls .orders-search-v147 input,
#ordersUnified .hml006-order-main-controls .orders-search-v147 button{
  height:38px!important;
  min-height:38px!important;
}
/* Lista/Kanban permanece imediatamente ao lado da pesquisa. */
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  flex:0 0 166px!important;
  width:166px!important;
  min-width:166px!important;
  max-width:166px!important;
  height:38px!important;
  min-height:38px!important;
  padding:3px!important;
  margin:0!important;
}
#ordersUnified .hml006-order-main-controls #ordersViewToggleV159 button{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  height:30px!important;
  min-height:30px!important;
  padding:3px 8px!important;
  font-size:11px!important;
}
/* Uploads + criação na mesma linha quando houver largura. */
#ordersUnified .unified-new-actions-v137{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:6px!important;
  flex-wrap:nowrap!important;
  flex:1 1 auto!important;
  min-width:0!important;
  margin-left:auto!important;
}
#ordersUnified .unified-new-actions-v137 .btn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
  height:38px!important;
  min-height:38px!important;
  padding:0 10px!important;
  white-space:nowrap!important;
  font-size:10px!important;
}

@media(max-width:1500px){
  .top-v171 #topActions .remote-actions .btn{font-size:10.5px!important;padding:0 5px!important;}
  #ordersUnified .unified-orders-toolbar-v137{flex-wrap:wrap!important;}
  #ordersUnified .hml006-order-main-controls{flex:1 1 610px!important;}
  #ordersUnified .unified-new-actions-v137{justify-content:flex-start!important;margin-left:0!important;}
}
@media(max-width:900px){
  .top-v171 #topActions .remote-actions{overflow-x:auto!important;justify-content:flex-start!important;}
  #ordersUnified .hml006-order-main-controls{flex-wrap:wrap!important;min-width:100%!important;}
  #ordersUnified .hml006-order-main-controls .orders-search-v147{width:100%!important;max-width:none!important;min-width:100%!important;}
  #ordersUnified .unified-new-actions-v137{width:100%!important;overflow-x:auto!important;}
}
