/* ========================================================
   01. BOTÕES GUT E SIGLA
   ======================================================== */

body.erp-tecnotextil-theme #tt-gut-toggle,
body.erp-tecnotextil-theme #tt-sigla-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;

  width: auto;
  min-width: 108px;
  min-height: 34px;

  margin: 0;
  padding: 6px 13px;

  background: #ffffff;
  color: #08345c;

  border: 1px solid #005e9d;
  border-radius: 5px;
  box-shadow: none;

  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

body.erp-tecnotextil-theme
:is(#tt-gut-toggle, #tt-sigla-toggle):hover:not(:disabled) {
  background: #b3d1ec;
  color: #08345c;
  border-color: #005e9d;
}

body.erp-tecnotextil-theme
:is(#tt-gut-toggle, #tt-sigla-toggle)[aria-pressed="true"] {
  background: #00663b;
  color: #ffffff;
  border-color: #00663b;
}

body.erp-tecnotextil-theme
:is(#tt-gut-toggle, #tt-sigla-toggle)[aria-pressed="true"]:hover:not(:disabled) {
  background: #005430;
  color: #ffffff;
  border-color: #005430;
}

body.erp-tecnotextil-theme
:is(#tt-gut-toggle, #tt-sigla-toggle):disabled {
  opacity: .5;
  cursor: not-allowed;
}

body.erp-tecnotextil-theme
:is(#tt-gut-toggle, #tt-sigla-toggle):focus-visible {
  outline: 2px solid #005e9d;
  outline-offset: 3px;
}

/* ========================================================
   02. EDITOR SIGLA
   ======================================================== */

body.erp-tecnotextil-theme .tt-sigla-editor {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 7px;

  min-width: 0;
  margin: 9px 0 5px;
  padding: 9px;

  background: #edf5fa;
  border: 1px solid #c3d7e4;
  border-left: 3px solid #005e9d;
  border-radius: 5px;
}

body.erp-tecnotextil-theme
.tt-sigla-editor label {
  display: flex;
  flex: 1 1 145px;
  flex-direction: column;
  gap: 4px;

  min-width: 0;
  margin: 0;

  color: #355a72;
  font-size: 11px;
  font-weight: 700;
}

body.erp-tecnotextil-theme
.tt-sigla-editor select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  font-size: 11px;
}

body.erp-tecnotextil-theme
.tt-sigla-editor button {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 6px 9px;
  margin: 0;
  font-size: 11px;
}

body.erp-tecnotextil-theme
.tt-sigla-editor .tt-sigla-legenda {
  flex-basis: 100%;
  margin: 0;
  color: #526f82;
  font-size: 10px;
  line-height: 1.5;
}

body.erp-tecnotextil-theme
.tt-sigla-editor .tt-sigla-somente-leitura {
  color: #526f82;
  font-size: 11px;
}

@media (max-width: 650px) {
  body.erp-tecnotextil-theme
  .tt-sigla-editor button {
    flex: 1 1 100%;
  }
}

/* ========================================================
   01. BOTÃO PARETO — SOMENTE SVG
   ======================================================== */

body.erp-tecnotextil-theme #tt-pareto-botao {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: flex-end !important;

  flex: 0 0 38px !important;

  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;

  height: 35px !important;
  min-height: 35px !important;
  max-height: 35px !important;

  margin: 0 0 0 auto !important;
  padding: 4px !important;

  background: #ffffff;
  color: #08345c;

  border: 1px solid #005e9d;
  border-radius: 5px;
  box-shadow: none;

  line-height: 1;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}

body.erp-tecnotextil-theme
#tt-pareto-botao:hover:not(:disabled) {
  background: #b3d1ec;
  border-color: #005e9d;
  color: #08345c;
}

body.erp-tecnotextil-theme
#tt-pareto-botao[aria-expanded="true"] {
  background: #eaf4fa;
  border-color: #005e9d;
  color: #08345c;
}

body.erp-tecnotextil-theme
#tt-pareto-botao:focus-visible {
  outline: 3px solid #005e9d;
  outline-offset: 3px;
}

/* Moldura interna do ícone */

body.erp-tecnotextil-theme
#tt-pareto-botao .tt-pareto-icone {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  flex: 0 0 26px !important;

  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;

  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;

  margin: 0 !important;
  padding: 0 !important;

  overflow: hidden;
  line-height: 1;
}

/* Limita dimensões internas do SVG original */

body.erp-tecnotextil-theme
#tt-pareto-botao .tt-pareto-icone svg,
body.erp-tecnotextil-theme
#tt-pareto-botao .tt-pareto-icone img {
  display: block !important;

  flex: 0 0 26px !important;

  width: 26px !important;
  height: 26px !important;

  min-width: 0 !important;
  min-height: 0 !important;

  max-width: 26px !important;
  max-height: 26px !important;

  margin: 0 !important;
  padding: 0 !important;

  object-fit: contain;
  overflow: hidden;
}

/* ========================================================
   02. BALÃO DE PLANEJAMENTO
   ======================================================== */

body.erp-tecnotextil-theme
#tt-pareto-balao {
  position: fixed;
  inset: auto;
  z-index: 900;

  width: min(460px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);

  margin: 0;
  padding: 0;

  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;

  background: #ffffff;
  color: #263746;

  border: 1px solid #b9cbd8;
  border-top: 4px solid #005e9d;
  border-radius: 9px;

  box-shadow:
    0 16px 42px rgba(8, 52, 92, .23);

  font-family:
    "Montserrat",
    "Segoe UI",
    Arial,
    sans-serif;

  font-size: 12px;
  line-height: 1.6;
}

body.erp-tecnotextil-theme
#tt-pareto-balao .tt-pareto-conteudo {
  padding: 16px;
}

body.erp-tecnotextil-theme
#tt-pareto-balao .tt-pareto-cabecalho {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;
  margin-bottom: 12px;
}

body.erp-tecnotextil-theme
#tt-pareto-balao h2 {
  margin: 0;
  color: #08345c;

  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

body.erp-tecnotextil-theme
#tt-pareto-balao .tt-pareto-subtitulo {
  margin: 5px 0 0;

  color: #526f82;
  font-size: 11px;
}

body.erp-tecnotextil-theme
#tt-pareto-fechar {
  flex: 0 0 auto;

  width: 30px;
  height: 30px;
  min-height: 30px;

  padding: 0;

  background: #ffffff;
  color: #08345c;

  border: 1px solid #c3d7e4;
  border-radius: 5px;
  box-shadow: none;

  font-size: 19px;
}

body.erp-tecnotextil-theme
#tt-pareto-fechar:hover {
  background: #edf5fb;
  color: #08345c;
}

/* ========================================================
   03. INDICADORES DO PARETO
   ======================================================== */

body.erp-tecnotextil-theme
.tt-pareto-resumo {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 10px;
  margin: 12px 0 15px;
}

body.erp-tecnotextil-theme
.tt-pareto-indicador {
  min-width: 0;
  padding: 11px;

  background: #f3f7fa;
  border: 1px solid #d6e4ed;
  border-radius: 6px;
}

body.erp-tecnotextil-theme
.tt-pareto-indicador.destaque {
  background: #eaf4fa;
  border-color: #b3d1ec;
}

body.erp-tecnotextil-theme
.tt-pareto-indicador span {
  display: block;

  color: #526f82;
  font-size: 10px;
  font-weight: 600;
}

body.erp-tecnotextil-theme
.tt-pareto-indicador strong {
  display: block;
  margin-top: 3px;

  color: #08345c;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
}

body.erp-tecnotextil-theme
.tt-pareto-explicacao {
  margin: 10px 0 15px;

  color: #526f82;
  font-size: 11px;
  line-height: 1.75;
}

/* ========================================================
   04. CATEGORIAS E BARRAS
   ======================================================== */

body.erp-tecnotextil-theme
.tt-pareto-categorias {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.erp-tecnotextil-theme
.tt-pareto-item {
  padding: 11px;

  background: #ffffff;

  border: 1px solid #d6e4ed;
  border-left: 4px solid var(--pareto-cor);
  border-radius: 5px;
}

body.erp-tecnotextil-theme
.tt-pareto-item-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

body.erp-tecnotextil-theme
.tt-pareto-item-titulo {
  color: #263746;
  font-size: 12px;
  font-weight: 700;
}

body.erp-tecnotextil-theme
.tt-pareto-item-quantidade {
  flex: 0 0 auto;

  color: #08345c;
  font-size: 13px;
  font-weight: 800;
}

body.erp-tecnotextil-theme
.tt-pareto-item-meta {
  margin: 2px 0 8px;

  color: #607080;
  font-size: 10px;
}

body.erp-tecnotextil-theme
.tt-pareto-barra {
  height: 9px;
  overflow: hidden;

  background: #e7edf3;
  border-radius: 20px;
}

body.erp-tecnotextil-theme
.tt-pareto-barra-preenchimento {
  height: 100%;
  width: 0;

  background: var(--pareto-cor);
  border-radius: inherit;
}

body.erp-tecnotextil-theme
.tt-pareto-diretriz {
  margin: 7px 0 0;

  color: #526f82;
  font-size: 10px;
}

body.erp-tecnotextil-theme
.tt-pareto-rodape {
  margin: 14px 0 0;
  padding-top: 11px;

  border-top: 1px solid #d6e4ed;

  color: #526f82;
  font-size: 10px;
  line-height: 1.7;
}

/* ========================================================
   05. FILTROS GUT E ÁREA
   ======================================================== */

body.erp-tecnotextil-theme
.tt-cl-filtro {
  display: block;
  min-width: 0;
  align-self: start;
}

body.erp-tecnotextil-theme
.tt-cl-filtro-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 8px;
  min-height: 25px;
}

body.erp-tecnotextil-theme
.tt-cl-filtro-cabecalho label {
  flex: 1;
  min-width: 0;
  margin: 0;

  font-size: 12px;
  font-weight: 600;
}

body.erp-tecnotextil-theme
.tt-cl-filtro > select {
  display: block;

  width: 100%;
  min-width: 0;
  margin-top: 5px;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-botao {
  flex: 0 0 27px;

  width: 27px;
  height: 25px;
  min-height: 25px;

  margin: 0;
  padding: 0;

  background: #ffffff;
  color: #08345c;

  border: 1px solid #b3d1ec;
  border-radius: 5px;
  box-shadow: none;

  font-size: 20px;
  line-height: 1;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-botao:hover:not(:disabled),
body.erp-tecnotextil-theme
.tt-cl-negativo-botao[aria-pressed="true"] {
  background: #f4b4b6;
  border-color: #a11217;
  color: #850b11;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-area {
  margin-top: 7px;
  padding: 9px;

  background: #fff8f8;

  border: 1px solid #f4b4b6;
  border-radius: 5px;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-area p {
  margin: 0 0 8px;

  color: #850b11;
  font-size: 10px;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-lista {
  display: flex;
  flex-direction: column;
  gap: 3px;

  max-height: 180px;
  overflow-y: auto;

  padding: 4px;

  background: #ffffff;
  border: 1px solid #d6e4ed;
  border-radius: 4px;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-opcao {
  display: flex;
  align-items: flex-start;
  gap: 7px;

  margin: 0;
  padding: 6px;

  border-radius: 4px;

  color: #263746;
  font-size: 11px;
  cursor: pointer;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-opcao:hover {
  background: #edf5fb;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-opcao input[type="checkbox"] {
  flex: 0 0 16px;

  width: 16px;
  height: 16px;
  min-height: 0;

  margin: 0;
  accent-color: #a11217;
}

body.erp-tecnotextil-theme
.tt-cl-negativo-opcao span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ========================================================
   06. RESPONSIVIDADE
   ======================================================== */

@media (max-width: 650px) {

  body.erp-tecnotextil-theme
  #tt-pareto-botao {
    margin-left: auto !important;
    flex: 0 0 38px !important;
  }

  body.erp-tecnotextil-theme
  #tt-pareto-balao {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  body.erp-tecnotextil-theme
  .tt-pareto-indicador strong {
    font-size: 21px;
  }
}

/* ========================================================
   07. IMPRESSÃO
   ======================================================== */

@media print {
  #tt-pareto-botao,
  #tt-pareto-balao {
    display: none !important;
  }
}

.resumo-gut {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9px;
}

.resumo-gut button {
  justify-content: flex-start;
  padding: 6px 9px;
  background: #edf5fb;
  border: 1px solid var(--tt-azul-pastel);
  color: var(--tt-azul-escuro);
  box-shadow: none;
  font-size: 12px;
  text-align: left;
}

.resumo-gut button:hover:not(:disabled) {
  background: var(--tt-azul-pastel);
  color: var(--tt-azul-escuro);
}

.nota-gut {
  min-width: 65px;
  max-width: 150px;
}

.gut-cartao {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.gut-cartao label {
  flex: 1;
  min-width: 80px;
  font-size: 12px;
}

.gut-criterio {
  flex: 1;
  min-width: 80px;
}

.gut-criterio select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.ajuda-gut {
  display: inline;
  min-height: 24px;
  padding: 2px 0;
  background: transparent;
  border: 0;
  color: var(--tt-azul-escuro);
  box-shadow: none;
  text-align: left;
  text-decoration: underline;
  font-size: 12px;
  font-weight: 500;
}

.ajuda-gut:hover:not(:disabled) {
  background: transparent;
  color: var(--tt-azul);
}

.tabela th .ajuda-gut,
.tabela th .ajuda-gut:hover:not(:disabled) {
  color: #ffffff;
}

dialog.balao-gut {
  position: fixed;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #ffffff;
  color: var(--tt-texto);
  border: 1px solid var(--tt-azul-pastel);
  border-top: 4px solid var(--tt-azul);
  border-radius: var(--tt-raio);
  box-shadow: var(--tt-sombra-modal);
  font-family: var(--tt-fonte);
  font-size: 13px;
  line-height: 1.5;
}

.balao-gut::backdrop {
  background: rgba(8, 30, 50, 0.28);
}

.balao-gut h3 {
  margin: 0 0 10px;
}

.balao-gut li {
  margin: 5px 0;
}

/* Os controles nunca herdam dimensões de logos ou botões de tela inteira. */
body.erp-tecnotextil-theme .nota-gut { min-width:65px; min-height:34px; max-width:150px; font-size:12px; }
body.erp-tecnotextil-theme .resumo-gut .meta { font-size:11px; }
body.erp-tecnotextil-theme .resumo-gut button { width:auto; min-height:30px; white-space:normal; }
body.erp-tecnotextil-theme .gut-cartao .gut-criterio { min-width:80px; }
body.erp-tecnotextil-theme .gut-cartao select { max-width:100%; }
body.erp-tecnotextil-theme .tt-area-sigla { white-space:nowrap; }
body.erp-tecnotextil-theme .task-table th .ajuda-gut { color:#fff; }
body.erp-tecnotextil-theme dialog.balao-gut { inset:auto; width:380px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
body.erp-tecnotextil-theme .tt-sigla-editor[hidden] { display:none; }
@media (max-width:650px) {
  body.erp-tecnotextil-theme .gut-cartao { gap:6px; }
  body.erp-tecnotextil-theme .gut-criterio .ajuda-gut { font-size:11px; }
  body.erp-tecnotextil-theme .tt-sigla-editor { padding:8px; }
}
@media print {
  #tt-gut-toggle,#tt-sigla-toggle,.tt-sigla-editor,.resumo-gut button,.balao-gut { display:none !important; }
}

/* Floating planning: keep the page interactive; expanded charts stack on mobile. */
body.erp-tecnotextil-theme #tt-pareto-balao.tt-pareto-expandido { width:min(1000px,calc(100vw - 24px)); }
#tt-pareto-balao .tt-pareto-acoes { display:flex; gap:5px; flex:none; }
#tt-pareto-balao .tt-pareto-acoes button { width:34px; height:34px; min-height:34px; padding:0; display:inline-flex; align-items:center; justify-content:center; background:#fff; color:#08345c; border:1px solid #c3d7e4; border-radius:5px; cursor:pointer; }
#tt-pareto-balao .tt-pareto-acoes button[aria-pressed="true"], #tt-pareto-balao .tt-pareto-acoes button[aria-expanded="true"] { background:#08345c; color:#fff; }
#tt-pareto-balao button:focus-visible, #tt-pareto-balao input:focus-visible, #tt-pareto-balao select:focus-visible { outline:2px solid #0066a4; outline-offset:2px; }
#tt-pareto-balao.tt-pareto-travado .tt-pareto-cabecalho > :first-child { cursor:move; touch-action:none; }
#tt-pareto-balao .tt-pareto-config { padding:10px 0; }
#tt-pareto-balao [hidden] { display:none !important; }
#tt-pareto-balao .tt-pareto-paineis { display:grid; grid-template-columns:minmax(0,1fr); gap:20px; }
#tt-pareto-balao.tt-pareto-expandido .tt-pareto-paineis { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
#tt-pareto-balao .tt-pareto-distribuicao { border-left:1px solid #d8e5ee; padding-left:16px; min-width:0; }
#tt-pareto-balao .tt-pareto-distribuicao h3 { color:#08345c; margin-top:0; }
#tt-pareto-balao .tt-pareto-pesos { display:grid; gap:10px; margin:12px 0; }
#tt-pareto-balao .tt-pareto-peso { display:flex; flex-wrap:wrap; align-items:end; gap:8px; background:#f3f8fc; padding:10px; border:1px solid #d8e5ee; border-radius:6px; }
#tt-pareto-balao .tt-pareto-peso > strong { flex:1 1 100%; overflow-wrap:anywhere; }
#tt-pareto-balao label { display:flex; flex-direction:column; gap:4px; font-size:11px; font-weight:600; }
#tt-pareto-balao input, #tt-pareto-balao select { box-sizing:border-box; border:1px solid #b9cbd8; border-radius:4px; min-height:34px; font:inherit; background:white; color:#263746; padding:5px; max-width:100%; }
#tt-pareto-balao input[type="number"] { width:76px; }
#tt-pareto-balao input[type="date"] { width:140px; }
#tt-pareto-balao .tt-pareto-peso button { padding:5px; background:white; color:#08345c; border:1px solid #b9cbd8; border-radius:4px; min-height:34px; }
#tt-pareto-balao .tt-pareto-grupos { display:grid; gap:12px; }
#tt-pareto-balao .tt-pareto-grupo { --pareto-cor:#0066a4; overflow-wrap:anywhere; }
#tt-pareto-balao .tt-pareto-aviso { color:#8a4200; background:#fff3dc; padding:9px; border-radius:4px; }
#tt-pareto-balao .tt-pareto-cache { color:#526f82; min-height:1.5em; font-size:10px; }
#tt-pareto-balao #tt-pareto-repartir, #tt-pareto-balao #tt-pareto-periodo-adicionar { margin:4px 6px 4px 0; font-size:11px; white-space:normal; }
@media(max-width:760px) {
  #tt-pareto-balao.tt-pareto-expandido .tt-pareto-paineis { grid-template-columns:minmax(0,1fr); }
  #tt-pareto-balao .tt-pareto-distribuicao { border-left:0; border-top:1px solid #d8e5ee; padding:16px 0 0; }
  #tt-pareto-balao .tt-pareto-cabecalho { flex-wrap:wrap; }
  #tt-pareto-balao .tt-pareto-acoes { margin-left:auto; }
  body.erp-tecnotextil-theme #tt-pareto-balao.tt-pareto-travado { max-height:70dvh; }
}
#tt-pareto-balao .tt-pareto-cabecalho { position:sticky; top:0; background:#fff; z-index:1; padding-bottom:8px; }
