/* Peças visuais compartilhadas da tela (botões, campos, painéis, janelas, avisos). */
.segmentado{display:inline-flex; align-items:stretch;
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:2px; gap:2px;}
.segmentado button{appearance:none; border:0; background:transparent; cursor:pointer;
  font-size:var(--t-corpo); font-weight:500; color:var(--text-secondary);
  padding:0 var(--s-3); height:calc(var(--altura-controle) - 6px);
  border-radius:calc(var(--radius-md) - 2px); white-space:nowrap;
  transition:color .12s, background .12s;}
.segmentado button:hover{color:var(--text-primary);}
.segmentado button.active{background:var(--surface); color:var(--text-primary); font-weight:600;
  box-shadow:0 1px 2px rgba(15,23,33,.08);}
.segmentado button:focus-visible{outline:none; box-shadow:var(--ring);}
.segmentado-mini button{font-size:var(--t-mini); height:24px; padding:0 var(--s-2);}
.painel-corpo.sem-respiro{padding-top:0;}
.drawer-overlay{position:fixed; inset:0; background:rgba(9,14,20,.45);
  opacity:0; pointer-events:none; transition:opacity .2s; z-index:140;}
.drawer-overlay.open{opacity:1; pointer-events:auto;}
.drawer{position:fixed; top:0; right:0; bottom:0; width:min(620px, 94vw); z-index:150;
  background:var(--surface); border-left:1px solid var(--border);
  box-shadow:var(--shadow-lg);
  display:flex; flex-direction:column;
  transform:translateX(100%); transition:transform .22s ease;}
.drawer.open{transform:none;}
.drawer-head{display:flex; align-items:flex-start; justify-content:space-between; gap:var(--s-3);
  padding:var(--s-4) var(--s-5); border-bottom:1px solid var(--border);}
.dh-title{font-size:var(--t-titulo); font-weight:600;}
.dh-sub{font-size:var(--t-mini); color:var(--text-secondary); margin-top:2px;}
.drawer-close{appearance:none; border:1px solid var(--border); background:var(--surface-2); cursor:pointer;
  width:28px; height:28px; border-radius:var(--radius-sm); color:var(--text-secondary); flex:none;}
.drawer-close:hover{border-color:var(--negative); color:var(--negative);}
.drawer-body{flex:1; overflow-y:auto; padding:var(--s-5); display:flex; flex-direction:column; gap:var(--s-4);}
.dash-skeleton{display:flex; flex-direction:column;}
.theme-switch{position:relative; appearance:none; cursor:pointer; flex:none;
  width:46px; height:24px; border-radius:var(--radius-pill);
  background:var(--chrome-field-bg); border:1px solid var(--chrome-border);
  display:inline-flex; align-items:center; justify-content:space-between; padding:0 5px;}
.theme-switch:focus-visible{outline:none; box-shadow:var(--ring);}
.ts-track-icon{display:grid; place-items:center; width:12px; height:12px; color:var(--chrome-text-dim);}
.ts-track-icon svg, .ts-thumb-icon svg{width:11px; height:11px; display:block; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round;}
.ts-thumb{position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%;
  background:var(--chrome-text); display:grid; place-items:center;
  transition:transform .18s ease; color:var(--chrome-bg-1);}
.ts-thumb-icon{display:none;}
.ts-thumb-icon.sun{display:grid;}
:root[data-theme="dark"] .ts-thumb, .theme-switch[aria-checked="true"] .ts-thumb{transform:translateX(22px);}
.theme-switch[aria-checked="true"] .ts-thumb-icon.sun{display:none;}
.theme-switch[aria-checked="true"] .ts-thumb-icon.moon{display:grid;}
@media (max-width:1280px){
  }
@media print{
  .drawer, .drawer-overlay{display:none !important;}
}
.kpi-label{font-size:var(--t-micro); font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--text-tertiary);}
td.num.pos{color:var(--positive);}
td.num.neg{color:var(--negative);}
@media (max-width:1100px), (pointer:coarse){
  .drawer{bottom:auto; height:100vh; height:100dvh;}
}
.sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;}
[hidden]{display:none !important;}
.btn{display:inline-flex; align-items:center; justify-content:center; gap:7px; height:var(--altura-controle); padding:0 14px;
  border-radius:var(--radius-md); font-size:var(--t-corpo); font-weight:600; cursor:pointer; text-decoration:none;
  border:1px solid transparent; font-family:inherit; white-space:nowrap; transition:background .12s,border-color .12s,color .12s;}
.btn:focus-visible{outline:none; box-shadow:var(--ring);}
.btn:disabled{opacity:.5; cursor:not-allowed;}
.btn svg{width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:1.9;}
.btn-primary{background:var(--brand); color:var(--brand-on);}
.btn-primary:hover:not(:disabled){background:var(--brand-strong);}
.btn-secondary{background:var(--surface); color:var(--text-primary); border-color:var(--border-strong);}
.btn-secondary:hover:not(:disabled){background:var(--surface-2);}
.btn-ghost{background:transparent; color:var(--text-secondary); border-color:transparent;}
.btn-ghost:hover:not(:disabled){color:var(--text-primary); background:var(--surface-2);}
.btn-danger{background:transparent; color:var(--negative); border-color:color-mix(in srgb, var(--negative) 45%, transparent);}
.btn-danger:hover:not(:disabled){background:var(--negative-soft);}
.btn-sm{height:28px; padding:0 10px; font-size:var(--t-mini);}
.icon-btn{width:30px; height:30px; border-radius:var(--radius-md); border:1px solid transparent; background:transparent;
  color:var(--text-secondary); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; font-size:14px;}
.icon-btn:hover{background:var(--surface-2); color:var(--text-primary);}
.field{display:flex; flex-direction:column; gap:5px; margin-bottom:var(--s-4);}
.field label{font-size:var(--t-mini); font-weight:600; color:var(--text-secondary);}
.input, .select{width:100%; height:var(--altura-controle); padding:0 11px; border:1px solid var(--border-strong); border-radius:var(--radius-md);
  background:var(--surface); color:var(--text-primary); font-family:var(--font-body); font-size:var(--t-corpo);
  transition:border-color .12s, box-shadow .12s;}
.select{appearance:none; padding-right:28px;
  background-image:linear-gradient(45deg,transparent 50%,var(--text-tertiary) 50%),linear-gradient(135deg,var(--text-tertiary) 50%,transparent 50%);
  background-position:calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size:5px 5px; background-repeat:no-repeat;}
.input:hover, .select:hover{border-color:var(--text-tertiary);}
.input:focus-visible, .select:focus-visible{outline:none; border-color:var(--brand); box-shadow:var(--ring);}
.input:disabled{opacity:.6;}
.msg{font-size:var(--t-corpo); border-radius:var(--radius-md); padding:10px 13px; margin-bottom:var(--s-3); line-height:1.5; border:1px solid transparent; border-left-width:3px;}
.msg.error{background:var(--negative-soft); color:var(--negative); border-color:var(--negative);}
.msg.success{background:var(--positive-soft); color:var(--positive-on-soft); border-color:var(--positive);}
.msg.warn{background:var(--warning-soft); color:var(--text-primary); border-color:var(--warning);}
.badge{display:inline-flex; align-items:center; gap:5px; font-size:var(--t-micro); font-weight:600; padding:3px 8px; border-radius:var(--radius-sm); background:var(--neutral-chip-bg); color:var(--neutral-chip-text); letter-spacing:.02em;}
.badge.pos{background:var(--positive-soft); color:var(--positive-on-soft);}
.badge.neg{background:var(--negative-soft); color:var(--negative);}
.badge.warn{background:var(--warning-soft); color:var(--warning);}
.badge.brand{background:var(--brand-soft); color:var(--brand-strong);}
.badge.ok{background:var(--positive-soft); color:var(--positive-on-soft);}
.page{max-width:var(--largura-max); width:100%; margin:0 auto; padding:var(--s-6) var(--s-5) var(--s-8); flex:1;}
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:var(--s-5);}
.painel{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);}
.painel-head{display:flex; align-items:center; justify-content:space-between; gap:var(--s-3); padding:var(--s-4) var(--s-5); border-bottom:1px solid var(--linha);}
.painel-head h2, .painel-head h3{font-size:var(--t-titulo);}
.painel-head .hint{font-size:var(--t-mini); color:var(--text-secondary); margin-top:2px;}
.painel-corpo{padding:var(--s-5);}
.modal-overlay{position:fixed; inset:0; background:rgba(10,15,22,.5); z-index:100; display:flex; align-items:flex-start; justify-content:center; padding:56px 16px; overflow-y:auto; -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px);}
.modal{width:100%; max-width:520px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg);}
.modal-head{display:flex; justify-content:space-between; align-items:flex-start; gap:var(--s-3); padding:var(--s-4) var(--s-5); border-bottom:1px solid var(--linha);}
.modal-head h3{font-size:var(--t-titulo);}
.modal-body{padding:var(--s-5);}
.modal-foot{display:flex; justify-content:flex-end; gap:var(--s-2); padding:var(--s-4) var(--s-5); border-top:1px solid var(--linha); background:var(--surface-2); border-radius:0 0 var(--radius-lg) var(--radius-lg);}
.modal-foot .btn-danger{margin-right:auto;}
.toast-wrap{position:fixed; right:18px; bottom:18px; display:flex; flex-direction:column; gap:8px; z-index:120;}
.toast{background:var(--chrome-bg-1); color:var(--chrome-text); border:1px solid var(--chrome-border); border-radius:var(--radius-md); padding:11px 14px; font-size:var(--t-corpo); box-shadow:var(--shadow-lg); max-width:360px;}
.toast.error{border-color:var(--negative);}
.toast.warn{border-color:var(--warning);}
.toast.saindo{opacity:0; transition:opacity .3s;}
.estado-vazio{display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px; padding:var(--s-8) var(--s-5); color:var(--text-secondary);}
.estado-vazio .ic{width:40px; height:40px; border-radius:var(--radius-md); background:var(--surface-2); display:grid; place-items:center; font-size:17px; color:var(--text-tertiary); margin-bottom:4px;}
.estado-vazio h2{font-size:var(--t-titulo); color:var(--text-primary);}
.estado-vazio p{font-size:var(--t-corpo); max-width:460px;}
@media (max-width:720px){
  .page{padding:var(--s-4) var(--s-4) var(--s-7);}
  :root{--topbar:48px;}
}
@media print{
  body{background:#fff;}
}
html{scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent;}
::-webkit-scrollbar{width:10px; height:10px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background-color:var(--border-strong);
  border-radius:var(--radius-pill);
  border:2px solid transparent;   
  background-clip:padding-box;}
::-webkit-scrollbar-thumb:hover{background-color:var(--text-tertiary);}
::-webkit-scrollbar-corner{background:transparent;}
.drawer-body::-webkit-scrollbar{width:8px; height:8px;}
.toast{display:flex; align-items:flex-start; gap:var(--s-3);}
.toast-fechar{appearance:none; cursor:pointer; flex:none; margin-left:auto;
  background:transparent; border:0; color:var(--chrome-text-dim);
  font-size:13px; line-height:1; padding:2px 4px; border-radius:var(--radius-sm);}
.toast-fechar:hover{color:var(--chrome-text); background:var(--chrome-pill-bg);}
.toast-fechar:focus-visible{outline:none; box-shadow:var(--ring);}
@media (pointer:coarse){
  :root{--altura-controle:44px;}
  .segmentado button{height:auto; min-height:40px;}
  .segmentado-mini button{height:40px;}
  .btn-sm{height:40px; padding:0 12px;}
  .icon-btn, .drawer-close, .toast-fechar{min-width:44px; min-height:44px;}
  .segmentado-mini button{min-width:40px;}
  details > summary{min-height:44px; display:flex; align-items:center;}
  .theme-switch{height:44px; background:transparent; border-color:transparent;}
  .theme-switch::before{content:''; position:absolute; left:-1px; right:-1px; top:9px; height:24px;
    border-radius:var(--radius-pill); background:var(--chrome-field-bg); border:1px solid var(--chrome-border);}
  .ts-track-icon{position:relative;}
  .ts-thumb{top:12px;}
  .btn{min-width:44px;}
}
@media (max-width:640px), (pointer:coarse){
  :root{--t-micro:12px; --t-mini:12.5px;}
}
@media (max-width:640px){
  .painel-head{flex-wrap:wrap;}
}
@media (max-height:500px) and (pointer:coarse){
  :root{--topbar:48px;}
}
