/* TrairiObras 3.36.24.93.36 · 9368
   Hotfix de contraste para módulos legados + proteção de overflow do cabeçalho.
   Não altera dados, regras documentais, CAD técnico nem a cartografia do Mapa Legal. */

/* 1) Módulos de Trabalhos: remover superfícies brancas herdadas do CSS legado. */
html[data-theme] .content .work-hero,
html[data-theme] .content .work-card,
html[data-theme] .content .technical-work-card,
html[data-theme] .content .technical-work-item,
html[data-theme] .content .work-dialog,
html[data-theme] .content .dialog-box,
html[data-theme] .content .import-strategy-card,
html[data-theme] .content .export-choice,
html[data-theme] .content .empty-state{
  background:var(--surface-1)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
}
html[data-theme] .content .work-hero{
  background:linear-gradient(115deg,var(--surface-1),var(--surface-2))!important;
  box-shadow:var(--shadow-soft)!important;
}
html[data-theme] .content .work-hero h2,
html[data-theme] .content .work-card h3,
html[data-theme] .content .technical-work-card h2,
html[data-theme] .content .technical-work-card h3,
html[data-theme] .content .dialog-head h3,
html[data-theme] .content .export-choice strong{
  color:var(--text-1)!important;
}
html[data-theme] .content .work-hero p,
html[data-theme] .content .technical-work-card p,
html[data-theme] .content .work-card dt,
html[data-theme] .content .work-card-foot,
html[data-theme] .content .dialog-help,
html[data-theme] .content .export-choice small,
html[data-theme] .content .technical-work-item small{
  color:var(--text-2)!important;
}
html[data-theme] .content .work-card dd,
html[data-theme] .content .technical-work-item strong{
  color:var(--text-1)!important;
}
html[data-theme] .content .work-flow-mini span,
html[data-theme] .content .work-card-actions,
html[data-theme] .content .geometry-summary>div,
html[data-theme] .content .generate-grid>div,
html[data-theme] .content .source-list>div,
html[data-theme] .content .upload-zone,
html[data-theme] .content .icon-btn{
  background:var(--surface-2)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
}
html[data-theme] .content .work-flow-mini b,
html[data-theme] .content .upload-zone div small,
html[data-theme] .content .source-list small,
html[data-theme] .content .geometry-summary span,
html[data-theme] .content .check-list small,
html[data-theme] .content .side-action small{
  color:var(--text-2)!important;
}
html[data-theme] .content .geometry-summary strong,
html[data-theme] .content .section-divider,
html[data-theme] .content .side-action strong,
html[data-theme] .content .check-list strong{
  color:var(--text-1)!important;
}
html[data-theme] .content .work-toolbar input{
  background:var(--surface-2)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
}
html[data-theme] .content .work-card-foot,
html[data-theme] .content .work-card-actions,
html[data-theme] .content .document-list,
html[data-theme] .content .source-list>div,
html[data-theme] .content .side-action{
  border-color:var(--stroke)!important;
}
html[data-theme] .content .work-status,
html[data-theme] .content .pill{
  background:var(--surface-3)!important;
  color:var(--text-2)!important;
  border:1px solid var(--stroke)!important;
}
html[data-theme] .content .pill.good,
html[data-theme] .content .status-concluido{
  color:var(--success)!important;
  border-color:color-mix(in srgb,var(--success) 40%,var(--stroke))!important;
  background:color-mix(in srgb,var(--success) 10%,var(--surface-2))!important;
}
html[data-theme] .content .pill.warning{
  color:var(--warning)!important;
  border-color:color-mix(in srgb,var(--warning) 40%,var(--stroke))!important;
  background:color-mix(in srgb,var(--warning) 10%,var(--surface-2))!important;
}
html[data-theme] .content .file-ext{
  background:var(--accent-soft)!important;
  color:var(--signal)!important;
}
html[data-theme] .content .btn.secondary,
html[data-theme] .content .btn.ghost{
  background:var(--surface-2)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
}
html[data-theme] .content .btn.danger{
  background:color-mix(in srgb,var(--danger) 9%,var(--surface-2))!important;
  color:var(--danger)!important;
  border-color:color-mix(in srgb,var(--danger) 42%,var(--stroke))!important;
}

/* Backup de Trabalhos: cada evento volta a ser uma linha legível. */
html[data-theme] .content .work-panel .document-list>div{
  display:grid!important;
  grid-template-columns:minmax(150px,.65fr) minmax(260px,1.45fr) auto!important;
  gap:10px!important;
  align-items:center!important;
  padding:8px 0!important;
  border-bottom:1px solid var(--stroke)!important;
  color:var(--text-1)!important;
}
html[data-theme] .content .work-panel .document-list>div small{color:var(--text-2)!important;min-width:0;overflow-wrap:anywhere}
html[data-theme] .content .backup-status-ok{color:var(--success)!important}
html[data-theme] .content .backup-status-fail{color:var(--danger)!important}

/* 2) WhatsApp: cards antigos não podem continuar brancos em tema escuro/azul/verde. */
html[data-theme] .content .wa-conversation-card,
html[data-theme] .content .wa-doc-list a{
  background:var(--surface-1)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
  box-shadow:var(--shadow-soft)!important;
}
html[data-theme] .content .wa-conversation-card:hover{
  background:var(--surface-2)!important;
  border-color:var(--stroke-strong)!important;
  box-shadow:var(--shadow-card)!important;
}
html[data-theme] .content .wa-avatar{
  background:var(--accent-soft)!important;
  color:var(--signal)!important;
}
html[data-theme] .content .wa-card-title strong,
html[data-theme] .content .wa-card-side strong,
html[data-theme] .content .wa-doc-list strong{
  color:var(--text-1)!important;
}
html[data-theme] .content .wa-card-meta span,
html[data-theme] .content .wa-card-main p,
html[data-theme] .content .wa-card-side small,
html[data-theme] .content .wa-doc-list span,
html[data-theme] .content .wa-doc-list code{
  color:var(--text-2)!important;
}
html[data-theme] .content .wa-card-side span{color:var(--signal)!important}
html[data-theme] .content .wa-stage{
  background:var(--surface-3)!important;
  color:var(--text-2)!important;
  border:1px solid var(--stroke)!important;
}
html[data-theme] .content .wa-chat-timeline{background:var(--surface-2)!important}
html[data-theme] .content .wa-bubble{
  background:var(--surface-1)!important;
  color:var(--text-1)!important;
  border:1px solid var(--stroke)!important;
}
html[data-theme] .content .wa-message.out .wa-bubble{
  background:color-mix(in srgb,var(--signal) 10%,var(--surface-1))!important;
  border-color:color-mix(in srgb,var(--signal) 28%,var(--stroke))!important;
}
html[data-theme] .content .wa-text{color:var(--text-1)!important}
html[data-theme] .content .wa-file{background:var(--surface-2)!important;border-color:var(--stroke)!important;color:var(--text-1)!important}
html[data-theme] .content .wa-msg-foot{color:var(--text-3)!important}

/* 3) Formulários/dialogs de Trabalhos fora das superfícies principais. */
html[data-theme] .work-dialog,
html[data-theme] .work-dialog form,
html[data-theme] .dialog-box{
  color-scheme:dark;
  background:var(--surface-1)!important;
  color:var(--text-1)!important;
}
html[data-theme] .work-dialog .field label{color:var(--text-2)!important}
html[data-theme] .work-dialog input,
html[data-theme] .work-dialog select,
html[data-theme] .work-dialog textarea{
  background:var(--surface-2)!important;
  color:var(--text-1)!important;
  border-color:var(--stroke)!important;
}

/* 4) Cabeçalhos com muitas ações (Editor/CAD/Trabalho): nada sobrepõe o título. */
@media (min-width:981px){
  .refined-topbar-9366{min-width:0!important;overflow:hidden!important}
  .topbar-heading{flex:1 1 240px!important;min-width:170px!important;max-width:420px!important;overflow:hidden!important}
  .topbar-heading h1,.topbar-heading p{overflow:hidden;text-overflow:ellipsis}
  .refined-top-actions-9366{flex:1 1 auto!important;min-width:0!important;max-width:calc(100% - 190px)!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:thin;padding-bottom:2px}
  .refined-top-actions-9366>*{flex:0 0 auto}
  .refined-global-search-9366{min-width:205px!important;max-width:280px!important}
  body:has(.cad-editor) .refined-global-search-9366,
  body:has(.cad-editor) .municipal-header-9366,
  body:has(.project-layout) .refined-global-search-9366,
  body:has(.project-layout) .municipal-header-9366,
  body:has(.memorial-paper) .refined-global-search-9366,
  body:has(.memorial-paper) .municipal-header-9366{display:none!important}
}

/* 5) Ajustes de tablet/celular e backups. */
@media (max-width:900px){
  html[data-theme] .content .work-panel .document-list>div{grid-template-columns:1fr!important;gap:3px!important}
  .work-flow-mini{overflow-x:auto;max-width:100%;padding-bottom:4px}
}
