:where(html, body){
  font-family:var(--font-family-base);
}

:where(button, input, select, textarea){
  font:inherit;
}

:where(.tabs, .comissionamento-subtabs, .composicao-view-toggle){
  display:flex;
  gap:10px;
  align-items:center;
  background:var(--surface-glass);
  border:1px solid var(--border-default);
  padding:6px;
  border-radius:var(--radius-md);
}

:where(.tab-btn){
  border:none;
  border-radius:calc(var(--radius-md) - 2px);
  padding:10px 12px;
  cursor:pointer;
  font-weight:700;
  background:transparent;
  color:var(--text-strong);
  transition:background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

:where(.tab-btn:hover){
  background:var(--btn-hover);
}

:where(.tab-btn.active){
  background:var(--color-accent);
  color:var(--color-ink);
}

:where(.comissionamento-tabs){
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin:0 0 18px;
}

:where(.comissionamento-tab-btn){
  border:1px solid var(--border-default);
  background:var(--surface-glass-2);
  color:var(--text-strong);
  border-radius:var(--radius-md);
  padding:14px 18px;
  font-size:15px;
  font-weight:700;
  cursor:pointer;
  transition:background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

:where(.comissionamento-tab-btn:hover){
  transform:translateY(-1px);
  border-color:var(--border-default);
  background:var(--btn-hover);
}

:where(.comissionamento-tab-btn.active){
  background:var(--color-accent);
  color:var(--color-ink);
  border-color:var(--color-accent);
}

:where(.btn, .btn-destaque, .btn-secundario, .btn-export, .btn-detalhe, .btn-toggle, .btn-tabs){
  border-radius:var(--radius-md);
  transition:background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

:where(.btn, .btn-secundario, .btn-export, .btn-detalhe, .btn-toggle, .btn-tabs, .icon-btn){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--border-default);
  cursor:pointer;
  font-weight:800;
}

:where(.btn){
  padding:12px 14px;
  color:var(--text-strong);
  background:var(--surface-glass-3);
}

:where(.btn:hover){
  background:var(--btn-hover);
  transform:translateY(-1px);
}

:where(.btn-destaque){
  background:var(--color-accent);
  color:var(--color-ink);
}

:where(.btn-destaque:hover){
  background:var(--color-accent-strong);
}

:where(.btn-secundario){
  background:var(--surface-glass-3);
  color:var(--text-strong);
}

:where(.btn-perigo){
  background:rgba(239,68,68,0.18);
  border-color:rgba(239,68,68,0.35);
}

:where(.btn-perigo:hover){
  background:rgba(239,68,68,0.26);
}

:where(.btn-export, .btn-detalhe, .btn-toggle, .btn-tabs, .icon-btn){
  color:var(--text-strong);
  background:var(--surface-glass-3);
}

:where(.btn-export:hover, .btn-detalhe:hover, .btn-toggle:hover, .btn-tabs:hover, .icon-btn:hover){
  background:var(--btn-hover);
  transform:translateY(-1px);
}

:where(.agenda-card, .info-card, .filtros-card, .card, .kpi-card, .tabela-card, .modal-content, .modal-card, .agenda-analytics-kpi, .agenda-analytics-panel, .metricas-composicao-card, .metricas-composicao-tech){
  background:var(--surface-glass);
  border:1px solid var(--border-default);
  color:var(--text-strong);
  box-shadow:0 18px 44px var(--shadow-card);
}

:where(.agenda-card, .info-card, .filtros-card, .card, .kpi-card, .tabela-card, .modal-content, .modal-card, .agenda-analytics-kpi, .agenda-analytics-panel, .metricas-composicao-card, .metricas-composicao-tech){
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

:where(.filtros-card){
  border-radius:var(--radius-xl);
  padding:18px;
}

:where(.filtros-grid){
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));
  gap:14px;
  align-items:end;
}

:where(.filtro-group, .form-group){
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

:where(.filtro-group label, .form-group label, .form-label){
  color:var(--text-muted);
  font-size:13px;
  font-weight:800;
}

:where(.filtro-group input, .filtro-group select, .form-group input, .form-group select, .form-group textarea){
  width:100%;
  border:1px solid var(--input-border, var(--border-default));
  border-radius:var(--radius-sm);
  padding:12px 14px;
  background:var(--input-bg, #f8fafc);
  color:var(--input-text, #111827);
  outline:none;
}

:where(.filtro-group input:focus, .filtro-group select:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus){
  border-color:var(--color-accent);
  box-shadow:0 0 0 3px rgba(219,143,17,0.22);
}

:where(.cards-grid, .metricas-kpis){
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:16px;
}

:where(.kpi-card, .info-card){
  border-radius:var(--radius-xl);
  padding:18px;
}

:where(.card-label, .card-sub){
  color:var(--text-muted);
}

:where(.card-label){
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.04em;
  text-transform:uppercase;
}

:where(.card-number){
  color:var(--text-strong);
  font-size:1.65rem;
  font-weight:900;
  line-height:1.1;
}

:where(.tabela-card){
  border-radius:var(--radius-xl);
  padding:18px;
  overflow:hidden;
}

:where(.tabela-header){
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
}

:where(.tabela-header h2, .tabela-header h3){
  margin:0;
  color:var(--text-strong);
}

:where(.tabela-header p){
  margin:4px 0 0;
  color:var(--text-muted);
}

:where(.metricas-table){
  width:100%;
  border-collapse:collapse;
}

:where(.metricas-table th){
  background:var(--surface-glass-3);
  color:var(--text-strong);
  font-weight:900;
}

:where(.metricas-table th, .metricas-table td){
  padding:14px 16px;
  border-bottom:1px solid var(--border-default-soft);
  text-align:left;
}

:where(.export-actions){
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

:where(.badge-pessoa, .metricas-pill, .time-badge){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-pill);
  font-weight:800;
}

:where(.badge-time, .status-pill){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:var(--radius-pill);
  font-size:12px;
  font-weight:800;
}

:where(.badge-pessoa){
  gap:6px;
  padding:2px 8px;
  font-size:11px;
  border:1px solid rgba(0,0,0,0.12);
  background:rgba(0,0,0,0.06);
}

:where(.hub-link){
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border-radius:var(--radius-pill);
  border:1px solid rgba(147,197,253,0.28);
  background:rgba(59,130,246,0.10);
  transition:transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  cursor:pointer;
}

:where(.hub-link:hover){
  background:rgba(219,143,17,0.12);
  border-color:rgba(219,143,17,0.35);
  box-shadow:0 0 18px rgba(219,143,17,0.22);
  transform:translateY(-1px);
  text-decoration:underline;
  text-underline-offset:2px;
}

:where(.metricas-pill){
  min-width:86px;
  padding:6px 10px;
  font-size:12px;
  color:var(--color-white);
}

:where(.time-badge){
  padding:6px 12px;
  font-size:13px;
  letter-spacing:.4px;
  box-shadow:0 4px 14px rgba(0,0,0,0.18);
}

:where(.badge-proprio, .metricas-time-row.badge-proprio .time-badge, .metricas-composicao-card.badge-proprio .time-badge, .metricas-composicao-tech.badge-proprio .time-badge){
  background:var(--time-proprio-bg);
  color:var(--time-proprio-fg);
}

:where(.badge-da, .metricas-time-row.badge-da .time-badge, .metricas-composicao-card.badge-da .time-badge, .metricas-composicao-tech.badge-da .time-badge){
  background:var(--time-da-bg);
  color:var(--time-da-fg);
}

:where(.badge-fm, .metricas-time-row.badge-fm .time-badge, .metricas-composicao-card.badge-fm .time-badge, .metricas-composicao-tech.badge-fm .time-badge){
  background:var(--time-fm-bg);
  color:var(--time-fm-fg);
}

:where(.badge-hg, .metricas-time-row.badge-hg .time-badge, .metricas-composicao-card.badge-hg .time-badge, .metricas-composicao-tech.badge-hg .time-badge){
  background:var(--time-hg-bg);
  color:var(--time-hg-fg);
}

:where(.badge-vit, .metricas-time-row.badge-vit .time-badge, .metricas-composicao-card.badge-vit .time-badge, .metricas-composicao-tech.badge-vit .time-badge){
  background:var(--time-vit-bg);
  color:var(--time-vit-fg);
}

:where(.badge-hm, .metricas-time-row.badge-hm .time-badge, .metricas-composicao-card.badge-hm .time-badge, .metricas-composicao-tech.badge-hm .time-badge){
  background:var(--time-hm-bg);
  color:var(--time-hm-fg);
}

:where(.badge-luxtel, .metricas-time-row.badge-luxtel .time-badge, .metricas-composicao-card.badge-luxtel .time-badge, .metricas-composicao-tech.badge-luxtel .time-badge){
  background:var(--time-luxtel-bg);
  color:var(--time-luxtel-fg);
}

:where(.status-ativo){
  background:var(--status-active-bg);
  color:var(--status-active-fg);
}

:where(.status-inativo){
  background:var(--status-inactive-bg);
  color:var(--status-inactive-fg);
}

:where(.link-acao){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border:1px solid var(--border-default);
  border-radius:10px;
  padding:8px 10px;
  color:var(--text-strong);
  background:transparent;
  cursor:pointer;
  font-weight:700;
  transition:border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

:where(.link-acao:hover){
  border-color:var(--border-default);
  background:var(--btn-hover);
  transform:translateY(-1px);
}

:where(.link-acao--danger){
  color:#fecaca;
  border-color:rgba(239,68,68,0.28);
}

:where(.link-acao--danger:hover){
  color:var(--color-white);
  background:rgba(239,68,68,0.18);
  border-color:rgba(239,68,68,0.40);
}

:where(.table-wrapper, .table-responsive){
  width:100%;
  overflow:auto;
}

:where(th.sortable){
  cursor:pointer;
  user-select:none;
}

:where(.sort-label){
  display:inline-flex;
  align-items:center;
  gap:6px;
}

:where(.sort-indicator){
  font-size:11px;
  opacity:.9;
}

:where(.overlay){
  position:fixed;
  inset:0;
  background:rgba(2,6,23,0.62);
  backdrop-filter:blur(8px);
  z-index:1000;
}

:where(.modal){
  position:fixed;
  inset:0 0 0 260px;
  width:calc(100vw - 260px);
  height:100vh;
  background:rgba(15,45,75,0.96);
  border-left:1px solid var(--border-default);
  z-index:1001;
  display:flex;
  flex-direction:column;
}

:where(.modal-header){
  padding:20px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--border-default-soft);
}

:where(.modal-title){
  font-size:18px;
  font-weight:800;
}

:where(.modal-subtitle){
  margin-top:4px;
  color:var(--text-muted);
  font-size:13px;
}

:where(.modal-body){
  padding:20px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
}

:where(.modal-footer){
  padding:16px 20px;
  border-top:1px solid var(--border-default-soft);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

:where(.modal-footer-right){
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

:where(.form-row){
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

:where(.input-bloqueado:disabled, .input-bloqueado[readonly]){
  background:rgba(15,23,42,0.28);
  color:rgba(255,255,255,0.88);
  cursor:not-allowed;
  opacity:1;
  text-overflow:ellipsis;
  overflow:hidden;
  white-space:nowrap;
  border:1px solid var(--border-default);
}

:where(.toast-area){
  position:fixed;
  right:18px;
  bottom:18px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:2000;
}

:where(.toast){
  min-width:260px;
  max-width:360px;
  padding:12px 14px;
  border:1px solid var(--border-default);
  border-radius:var(--radius-md);
  background:rgba(15,23,42,0.92);
  color:var(--color-white);
  box-shadow:0 20px 50px rgba(0,0,0,0.35);
  backdrop-filter:blur(10px);
}

:where(.toast.ok, .toast-success){
  border-color:rgba(34,197,94,0.35);
}

:where(.toast.err, .toast-error){
  border-color:rgba(239,68,68,0.35);
}

:where(.toast .t-title){
  margin-bottom:4px;
  font-weight:800;
}

:where(.toast .t-body){
  color:rgba(255,255,255,0.85);
  font-size:13px;
}

:where(.hidden){
  display:none !important;
}

@media (max-width: 768px){
  :where(.tabs, .comissionamento-subtabs, .composicao-view-toggle){
    gap:8px;
    flex-wrap:wrap;
  }

  :where(.modal){
    left:0;
    width:100vw;
  }

  :where(.form-row){
    grid-template-columns:1fr;
  }
}

:root[data-theme="light"] :where(.badge-pessoa){
  border-color:rgba(15,23,42,0.12);
  background:rgba(15,23,42,0.04);
}

:root[data-theme="light"] :where(.hub-link){
  border-color:rgba(59,130,246,0.28);
}

:root[data-theme="light"] :where(.metricas-pill, .time-badge){
  box-shadow:0 4px 14px rgba(2,6,23,0.12);
}
