/* Demanda técnica: filtro de vários contratos, cancelada, aguardando retorno,
   visitas e equipamento parado (30/09/2026). Tudo sob #technicalDemandsPanel.
   Os status usam classes novas (status-canceled, status-waiting): as genéricas
   de styles.css pintariam outras coisas (ver §9-BP). */

/* ---- Filtro de contratos: mesmo visual dos rótulos do cartão de filtros ---- */
#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-campo {
  display: grid;
  gap: 6px;
  position: relative;
  min-width: 0;
}

#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-campo.hidden {
  display: none !important;
}

#technicalDemandsPanel .filtro-contratos-legenda {
  color: var(--fc-app-muted, #5b6b82);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

#technicalDemandsPanel .filtro-contratos {
  position: relative;
}

#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-botao {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: #eef2f7;
  color: #10233f;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#technicalDemandsPanel .filtro-contratos-botao::after {
  content: "▾";
  flex: none;
  font-size: 12px;
}

#technicalDemandsPanel .filtro-contratos-botao > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

#technicalDemandsPanel .filtro-contratos-painel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  box-sizing: border-box;
  width: min(238px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  padding: 5px;
  background: #fff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 35, 63, 0.14);
}

#technicalDemandsPanel .filtro-contratos-painel[hidden] {
  display: none !important;
}

#technicalDemandsPanel .filtro-contratos-atalhos {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 2px 0;
  margin-top: 3px;
  border-top: 1px solid #eef2f7;
}

#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-atalhos button {
  min-height: 24px;
  padding: 0 4px;
  white-space: nowrap;
}

#technicalDemandsPanel .filtro-contratos-painel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  max-height: 210px;
  overflow-y: auto;
}

#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-opcao {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: #10233f !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  cursor: pointer;
}

#technicalDemandsPanel .technical-demand-filter-card .filtro-contratos-opcao input {
  min-height: 0;
  width: 16px;
  height: 16px;
  margin: 0;
}

/* ---- Cartão: status, avisos do ciclo e equipamento parado ---- */
#technicalDemandsPanel .record-status.status-canceled {
  background: #f1f3f6;
  color: #5b6b82;
  border: 1px solid #d8e0ea;
}

#technicalDemandsPanel .record-status.status-waiting {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

#technicalDemandsPanel .td-aviso,
#technicalDemandsPanel .td-visitas {
  display: grid;
  gap: 2px;
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid #c2410c;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 13px;
  overflow-wrap: anywhere;
}

#technicalDemandsPanel .td-aviso strong,
#technicalDemandsPanel .td-visitas strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#technicalDemandsPanel .td-aviso-cancelada {
  border-left-color: #5b6b82;
  background: #f5f7fa;
  color: #344054;
}

#technicalDemandsPanel .td-visitas {
  border-left-color: #1d4ed8;
  background: #eff6ff;
  color: #1e3a8a;
}

#technicalDemandsPanel .td-parado strong {
  color: #b42318;
}

/* ---- Precedência ----
   O cartão de filtros tem overflow:hidden, que cortava o painel da lista, e o
   control-standard.css pinta TODO botão do painel com um seletor de quatro IDs
   e !important. Medido no navegador em 30/09/2026 (getComputedStyle). Estas
   regras só vencem com o mesmo peso — é a briga de especificidade de §8-P e
   §9-AZ; aqui ela fica restrita aos elementos do filtro. */
#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandFilters.has-contract-filter {
  overflow: visible !important;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-botao {
  background: #eef2f7 !important;
  color: #10233f !important;
  border: 1px solid #d8e0ea !important;
  box-shadow: none !important;
  justify-content: space-between !important;
  font-weight: 600 !important;
}

/* A opção é um <label>, e os rótulos do cartão de filtros são pequenos e em
   caixa alta: o nome do contrato herdava isso. */
#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-opcao {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 0 !important;
  padding: 5px 7px !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 5px !important;
  color: #10233f !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-opcao:hover,
#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-opcao:focus-within {
  background: #f1f6fc !important;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-opcao:has(input:checked) {
  background: #eaf2fc !important;
}

#technicalDemandsPanel .filtro-contratos-opcao span {
  overflow-wrap: anywhere;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-atalhos button {
  width: auto !important;
  min-height: 24px !important;
  padding: 0 4px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #285884 !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-atalhos button:hover {
  text-decoration: underline !important;
}

#dashboardView#dashboardView#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .filtro-contratos-opcao input {
  min-height: 0 !important;
  width: 16px !important;
  height: 16px !important;
  padding: 0 !important;
  margin: 0 !important;
  accent-color: #1d578e;
}

/* Nos avisos, o nome e a data são texto: nada de caixa alta. */
#technicalDemandsPanel .td-aviso strong,
#technicalDemandsPanel .td-visitas strong {
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Relatórios e Dashboard: o ciclo fora da tela Demanda (01/10/2026) ----
   "Cancelada" e "Aguardando retorno" saíam com a cor de "aberta". Os selos
   usam as mesmas cores do cartão da demanda; as barras do quadro de status do
   Dashboard ganham as duas linhas novas. */
#dashboardView:not(.hidden) #reportsPanel .record-status.status-canceled,
#dashboardView:not(.hidden) #dashboardPanel .record-status.status-canceled {
  background: #f1f3f6 !important;
  color: #5b6b82 !important;
  border: 1px solid #d8e0ea !important;
}

#dashboardView:not(.hidden) #reportsPanel .record-status.status-waiting,
#dashboardView:not(.hidden) #dashboardPanel .record-status.status-waiting {
  background: #fff7ed !important;
  color: #c2410c !important;
  border: 1px solid #fed7aa !important;
}

#dashboardPanel .status-bar span.waiting {
  background: #f59e0b;
}

#dashboardPanel .status-bar span.canceled {
  background: #9aa8ba;
}

/* Cabeçalho conforme a largura do cartão, inclusive com três colunas e zoom.
   A data e os selos não disputam espaço com um título comprido. */
#dashboardView#dashboardView#dashboardView #technicalDemandsPanel .technical-demand-card-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)) !important;
  align-items: stretch !important;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList > .technical-demand {
  container: technical-demand-card / inline-size;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-main {
  display: block !important;
  flex: 1 1 auto;
  min-width: 0;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-heading {
  min-width: 0 !important;
  overflow-wrap: anywhere;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-title-row {
  flex-wrap: wrap !important;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-header-meta {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px 12px !important;
  min-width: 0;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-opened {
  justify-items: start !important;
  text-align: left;
  white-space: nowrap;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-badges {
  justify-content: flex-start !important;
  max-width: 100%;
}

#dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-footer {
  margin-top: auto !important;
}

@container technical-demand-card (min-width: 560px) {
  #dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 20px !important;
  }

  #dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-header-meta {
    display: grid !important;
    justify-items: end !important;
  }

  #dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-opened {
    justify-items: end !important;
    text-align: right;
  }

  #dashboardView#dashboardView#dashboardView #technicalDemandsList .technical-demand-badges {
    justify-content: flex-end !important;
  }
}

/* Último envio com "Não se aplica" ao lado (14/10/2026): a demanda que não é
   de equipamento parado (uma vistoria, por exemplo) não tem data a informar. */
#technicalDemandForm:not(.hidden) .technical-demand-stopped-field {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  min-width: 0;
}

#technicalDemandForm:not(.hidden) .technical-demand-stopped-field > label:first-child {
  flex: 1 1 190px;
  min-width: 0 !important;
}

#technicalDemandForm:not(.hidden) .technical-demand-stopped-field .technical-demand-stopped-na {
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center !important;
  gap: 8px !important;
  width: auto !important;
  min-height: 40px;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap;
  cursor: pointer;
}

#technicalDemandForm:not(.hidden) .technical-demand-stopped-na span {
  display: inline !important;
  color: inherit !important;
}

#technicalDemandForm:not(.hidden) #technicalDemandStoppedAtInput:disabled {
  background: #eef2f6 !important;
  color: #8a96a6 !important;
  cursor: not-allowed;
}

/* Contrato de teste (14/10/2026): selo na lista de contratos e no card da
   demanda, e a caixa no cadastro do contrato, só com o nome da opção (o texto
   explicativo saiu a pedido do titular). */
.contrato-teste-selo {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid #f0c36d;
  border-radius: 999px;
  background: #fff6e0;
  color: #7a4d00;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}

#dashboardView#dashboardView#dashboardView#dashboardView .contrato-teste-campo {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  grid-column: 1 / -1;
  padding: 10px 12px !important;
  border: 1px dashed #c9d3e0;
  border-radius: 8px;
  background: #f7f9fc;
  cursor: pointer;
}

#dashboardView#dashboardView#dashboardView#dashboardView .contrato-teste-campo input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  accent-color: #1f4070;
}

#dashboardView#dashboardView#dashboardView#dashboardView .contrato-teste-campo span {
  display: grid !important;
  gap: 3px;
  color: #143454;
  font-size: 14px;
  font-weight: 700;
  text-transform: none !important;
  letter-spacing: normal !important;
}
