/* DH Empreiteira V15.15 — tema escuro coeso, revisão de contraste e componentes.
   Exclusivo do modo escuro. Relatórios para impressão não recebem este tema. */
html[data-dh-theme="dark"] {
  color-scheme: dark;
  --dh-dark-bg: #091421;
  --dh-dark-surface: #14283a;
  --dh-dark-surface-alt: #192f43;
  --dh-dark-input: #112639;
  --dh-dark-border: #32485b;
  --dh-dark-text: #f0f5fb;
  --dh-dark-muted: #b4c3d2;
  --dh-dark-gold: #f1c86e;
  --dh-dark-blue: #87c6ff;
  --dh-dark-green: #70e0b0;
  --dh-dark-red: #ff9ba2;
  --dh13-surface: var(--dh-dark-surface);
  --dh13-surface2: var(--dh-dark-surface-alt);
  --dh13-bg: var(--dh-dark-bg);
  --dh13-text: var(--dh-dark-text);
  --dh13-muted: var(--dh-dark-muted);
  --dh13-line: var(--dh-dark-border);
}
html[data-dh-theme="dark"] body,
html[data-dh-theme="dark"] #app .main,
html[data-dh-theme="dark"] .screen.on:not(.login),
html[data-dh-theme="dark"] #app {background:var(--dh-dark-bg)!important;color:var(--dh-dark-text)!important}
/* Níveis principais: um fundo consistentemente escuro, sem cards brancos */
html[data-dh-theme="dark"] :is(
 .card,.h145section,.h156-kpi,.h145kpi,.h145quick,.h145stat,.h145line,.h145alert,.home-kpi,.home-greet,
 .ev-hero,.ev-progress-card,.ev-item,.ev-chip,.ev-pct,.ev-status,.ev-photos,.client-card,.quote-card,.move-card,
 .more151-row,.more-card,.card11,.partner11,.v15-toolcard,.v15-invoicecard,.v15-worknote,.v15-metric,
 .work-card,.work-list-card,.v13-fin-card,.v13-tabs,.v13-note,.v13-client-address,.v13-mini,.v13-expense,
 .s147row,.s147summary,.s147pick,.s147summary,.q148totals,.q148readonly,.sum,
 .pro158-status,.pro158-actions,.pro158-row,.pro1510-status,.pro1510-actions,.pro1510-row,
 .agenda159-work,.agenda159-dayjob,.agenda159-empty,.agenda1510-work,.agenda1510-dayjob,
 .agenda156-selected,.agenda156-legend,.agenda156-month,.agenda156-job,.agenda156-note,.agenda159-list,
 .work158-note,.work158-month,.quote158-input,.quote158-typegrid button,
 .fin153-kpi,.fin153-section,.fin153-report,.fin153-view,.fin153-count,.fin153-mini,
 .rh153-user,.rh153-day,.rh153-history,.rh153-person,.rh153-time,.rh153-login,.rh153-status,
 .rh154-readonly,.rh154-other,.rh154-switch,
 .selectrow152,.choicepage152,.choiceempty152,.serviceitem152,.clean-summary152,.toggleline152,
 .clean-money152,.clean-money152 span,.keep153,.keep153-track,.v15-fiscalnote,
 .invoice156-scan,.invoice156-status,.receipt156,.receipt156-key,.receipt156-items,
 .tool13-summary>div,.tool13-row,.tool13-photo,.tool13-empty,.tool13-detail,.tool13-detailgrid>div,
 .tool13-photoedit,.tool13-photoedit-preview,.tool13-switch,.tool13-detail-photo,
 .tool151-imagebox,.tool151-gallery,.tools151-metric,.tool151-category,.v15-toolsbar,
 .report-card,.client1510-work,.client1510-section,.client1510-quick,.client1510-fin,.client1510-update,
 .detailbar,.pickrow,.sheet-option,.pick11,.action-card,.action-grid button,.quick button,.nav-icon151
){background:var(--dh-dark-surface)!important;border-color:var(--dh-dark-border)!important;color:var(--dh-dark-text)!important;box-shadow:none!important}
/* Subsuperfícies */
html[data-dh-theme="dark"] :is(
 .searchbox,.tool151-search,.tool13-search,.tool13-filters,.tool13-toolbar,
 .work158-datehead,.quote158-typegrid button.on,.choice.on,.type11 button.on,
 .ev-chip,.badge,.ledger-icon,.v15-toolphoto,.more151-icon,.v15-preview,
 .agenda159-toolbar button.secondary,.agenda1510-toolbar button.secondary,
 .rh153-avatar,.rh153-time,.rh154-badge,.h145alert .ai,
 .move-icon,.badge11,.avatar,.mi,.circle,.ev-icon,.stepval,
 .tool13-actions button,.tool13-state,.tool13-photoedit .pick,
 .switch152,.photo-buttons152 label,.v15-photoadd,.photoadd,
 .tool151-chip,.tool13-filter,.filterchip,.client-tab,.detailtab,
 .selectrow152 .sicon,.clean-money152 span,.invoice156-cardtag,
 .tool13-detailgrid>div,.v13-status button,.v13-tabs button,
 .money12,.money12 b,.v13-money,.quick,.iconbtn,.s147pick
){background:var(--dh-dark-surface-alt)!important;border-color:var(--dh-dark-border)!important;color:var(--dh-dark-text)!important}
/* Texto: cobre especificidades e !important de CSS antigos */
html[data-dh-theme="dark"] :is(
 .h156-kpi small,.h156-kpi .meta,.h145title,.h145section h3,
 .tool13-head h3,.tool13-summary strong,.tool13-titleline strong,.tool13-price,
 .tool13-detailgrid b,.tool13-empty b,.tool13-form label,.tool13-switch b,
 .v15-toolsbar h3,.more151-head h2,.more151-copy strong,
 .page-title,.page-sub,.ev-title,.ev-stage,.ev-percent,.ev-meta,.ev-desc,
 .work-name,.work-info,.work-list-card,.client-tabs,.clean152 label,
 .type11 button,.pick11,.pickrow,.sheet-option,.choice,.card11,.card11 b,
 .serviceitem152,.selectrow152 .scopy b,.fin153-copy b,.fin153-sectionhead h3,
 .fin153-kpi strong,.rh153-dayhead h3,.rh153-user b,.rh153-day b,
 .pro158-status b,.pro1510-status b,.agenda159-head h3,
 .agenda1510-head h3,.agenda159-daytitle,.work158-month h4,
 .quote158-input label,.client1510-work b,.client1510-section h3,
 .h145alert,.h145alert b,.h145empty,.receipt156-body,
 .v13-fin-card,.kpi,.tool13-detailgrid b,.k12 b
){color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(
 .muted,.page-sub,.more151-section,.ev-meta,.ev-desc,.ev-chip,
 .work-list-card small,.work-info small,.work158-legend span,
 .tool13-meta,.tool13-secondary,.tool13-summary small,.tool13-detailgrid span,
 .v15-subtle,.more151-copy small,.fin153-copy small,.rh153-user small,
 .rh153-day small,.pro158-status small,.pro158-row small,.pro1510-status small,
 .agenda159-work small,.agenda159-dayjob small,.agenda1510-work small,.agenda1510-dayjob small,
 .work158-note,.quote158-manualnote,.receipt156-row span,
 .ev-sub,.ev-legend,.v13-client-address,.client1510-meta,
 .h156-kpi .meta,.h145section .muted
){color:var(--dh-dark-muted)!important}
html[data-dh-theme="dark"] :is(.h156-kpi,.h145section,.h145alert,.h156-kpi.quote,.kpi) strong,
html[data-dh-theme="dark"] .h145title h3{color:var(--dh-dark-text)!important}
/* O tema anterior tornava todo texto small cinza, inclusive números legíveis. */
html[data-dh-theme="dark"] :is(.card,.ui-sheet,.h145section,.h156-kpi,.tool13-row,.more151-row,.v15-toolcard,.pro158-actions,.fin153-section,.rh153-day) small{color:var(--dh-dark-muted)!important}
/* Controles e formulários */
html[data-dh-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background:var(--dh-dark-input)!important;border:1px solid #40566a!important;color:var(--dh-dark-text)!important;box-shadow:none!important;caret-color:var(--dh-dark-gold)!important}
html[data-dh-theme="dark"] :is(input,textarea)::placeholder{color:#acbbca!important;opacity:1}
html[data-dh-theme="dark"] :is(.ui-sheet,.ui-head,.ui-modal .sheet,.ui-modal .ui-sheet){background:var(--dh-dark-surface)!important;border-color:var(--dh-dark-border)!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.ui-head h3,.ui-sheet h2,.ui-sheet h3,.ui-sheet h4,.ui-sheet label,.form label,.field label,.form-section152 h4,.section-head h3){color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.ui-close,.backbtn,.v15-back,.r14back,.work158-datehead button,.agenda159-panel-head button,.agenda1510-back,.choiceback152,.tool13-actions button,.quote158-clear){background:#243b50!important;color:#eef6ff!important;border:1px solid #466278!important;box-shadow:none!important}
html[data-dh-theme="dark"] :is(.btn,.primary-wide,.bigadd,.tool13-add,.stepbtn){background:#295776!important;color:#f9fcff!important;border-color:#46718d!important}
html[data-dh-theme="dark"] :is(.btn.light,.btn.secondary,.secondary,.cancel,.btn.red,.tool13-actions .del){background:#263d50!important;color:var(--dh-dark-text)!important;border-color:#466078!important}
html[data-dh-theme="dark"] :is(.btn.red,.tool13-actions .del,.negative){color:var(--dh-dark-red)!important}
html[data-dh-theme="dark"] :is(.btn.green,.positive){color:var(--dh-dark-green)!important}
html[data-dh-theme="dark"] :is(.btn.green,.finance-actions12 .receive){background:#106b56!important;color:#fff!important}
html[data-dh-theme="dark"] :is(.finance-actions12 .expense){background:#993b4c!important;color:#fff!important}
/* Seleções e navegação */
html[data-dh-theme="dark"] :is(.detailtab,.client-tab,.filterchip,.tool13-filter,.tool151-chip,.choice,.sheet-option,.type11 button){background:var(--dh-dark-surface-alt)!important;color:var(--dh-dark-text)!important;border-color:var(--dh-dark-border)!important}
html[data-dh-theme="dark"] :is(.detailtab.on,.client-tab.on,.filterchip.on,.tool13-filter.on,.tool151-chip.on,.choice.on,.sheet-option.on,.type11 button.on,.theme1513 button.on){background:#23506d!important;color:#d1ecff!important;border-color:#679dc0!important}
html[data-dh-theme="dark"] :is(.v13-status .on,.v13-tabs .on){background:#23506d!important;color:#d1ecff!important}
html[data-dh-theme="dark"] :is(.choicepage152,.work158-datepage,.quote158-discpage,.agenda159-panel,.agenda1510-panel,.fin153-view){background:var(--dh-dark-bg)!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.work158-datehead,.agenda159-panel-head,.agenda1510-head){background:#112435!important;border-color:var(--dh-dark-border)!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.work158-datehead h3,.agenda159-panel-head h3,.agenda1510-head h3){color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.work158-day,.agenda156-day:not([style])){background:#214a3f!important;color:#e0fff2!important;border-color:#376457!important}
html[data-dh-theme="dark"] :is(.work158-day.past,.work158-day.blocked,.agenda156-day.past){background:#1a2b3a!important;color:#718497!important;border-color:#324455!important}
html[data-dh-theme="dark"] :is(.work158-day.selected,.work158-day.today,.agenda156-day.today){background:#285271!important;color:#ecfaff!important;border-color:#a3d4ff!important}
html[data-dh-theme="dark"] :is(.work158-day.blank,.agenda156-day.empty){background:transparent!important;border-color:transparent!important}
/* Datas da agenda ocupadas usam cores personalizadas de cada obra, mantidas no inline style. */
html[data-dh-theme="dark"] .agenda156-day[style]{filter:brightness(.87) saturate(.92)}
html[data-dh-theme="dark"] .agenda156-day[style] .count{color:inherit!important}
/* Cards financeiros e indicadores: ícones continuam coloridos, textos sempre nítidos */
html[data-dh-theme="dark"] :is(.k12,.fin153-kpi,.h156-kpi,.v15-metric,.home-kpi){background:var(--dh-dark-surface)!important;border:1px solid var(--dh-dark-border)!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.k12.green,.k12.red,.k12.gold,.k12.blue,.k12.purple){background:var(--dh-dark-surface)!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.h156-kpi strong,.k12 b,.fin153-kpi b,.fin153-kpi strong,.home-kpi strong){color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.h156-kpi .ico,.h145stat .ico,.h145quick .ico,.nav-icon151,.nav-icon153){background:#203d52!important;color:var(--dh-dark-gold)!important}
html[data-dh-theme="dark"] :is(.h145alert.red,.h145alert.gold,.h145alert.blue){background:#1b3143!important;color:var(--dh-dark-text)!important}
html[data-dh-theme="dark"] :is(.h145alert.red .ai){background:#4a2836!important;color:var(--dh-dark-red)!important}
html[data-dh-theme="dark"] :is(.h145alert.gold .ai){background:#4b3b24!important;color:var(--dh-dark-gold)!important}
html[data-dh-theme="dark"] :is(.h145alert.blue .ai){background:#213d56!important;color:var(--dh-dark-blue)!important}
html[data-dh-theme="dark"] :is(.green,.positive,.tool13-state.good){color:var(--dh-dark-green)!important}
html[data-dh-theme="dark"] :is(.red,.negative,.tool13-state.bad){color:var(--dh-dark-red)!important}
html[data-dh-theme="dark"] :is(.tool13-state.good){background:#16473c!important}
html[data-dh-theme="dark"] :is(.tool13-state.warn){background:#4b3d24!important;color:#f3ce79!important}
html[data-dh-theme="dark"] :is(.tool13-state.bad){background:#4d2b38!important}
html[data-dh-theme="dark"] :is(.tool13-state,.statuspill,.statuspill.done,.statuspill.pause,.ev-status,.ev-status.done,.ev-pct,.v15-origin){border:1px solid var(--dh-dark-border)!important;background:#223c50!important;color:#d4ecff!important}
html[data-dh-theme="dark"] :is(.statuspill.done,.ev-status.done){background:#164738!important;color:var(--dh-dark-green)!important}
html[data-dh-theme="dark"] :is(.statuspill.pause){background:#4c2d39!important;color:var(--dh-dark-red)!important}
/* Cartões da tela inicial: impedir branco gerado em camadas antigas */
html[data-dh-theme="dark"] .h156-kpis .h156-kpi{background:#14293d!important;border:1px solid #334c62!important;border-radius:19px!important;box-shadow:0 3px 16px rgba(0,0,0,.12)!important}
html[data-dh-theme="dark"] .h156-kpis .h156-kpi small{color:#c5d0dd!important}
html[data-dh-theme="dark"] .h156-kpis .h156-kpi .meta{color:#abbccc!important}
html[data-dh-theme="dark"] .h156-kpis .h156-kpi strong{color:#f1c86e!important}
html[data-dh-theme="dark"] .h145section{background:#14283a!important;border:1px solid #32495e!important}
html[data-dh-theme="dark"] .h145section :is(h3,.h145title,.h145empty){color:#eef5fb!important}
/* Lista de serviços: botões não devem parecer caixas brancas ou 3D */
html[data-dh-theme="dark"] :is(.serviceitem152,.serviceitem152 button,.services147-list .card,.s147row){border-color:#334c62!important;color:#eef5fb!important;box-shadow:none!important}
html[data-dh-theme="dark"] :is(.serviceitem152 .iconbtn,.s147row button,.iconbtn,.edit12,.del12){background:#243e53!important;border:1px solid #405d72!important;border-radius:10px!important;color:#d8ebfb!important;box-shadow:none!important;appearance:none!important}
html[data-dh-theme="dark"] :is(.serviceitem152 .del12,.s147row .del12){background:#472e3c!important;color:#ffbbc1!important}
/* Áreas com gradiente/hero intencional: preservar hierarquia e textos brancos */
html[data-dh-theme="dark"] :is(.more-hero,.david-summary,.fin-hero,.hero11,.pro158-hero,.pro1510-hero,.fin153-hero,.hero156,.h145hero){background:linear-gradient(135deg,#123b59,#0f2b43)!important;color:#f5faff!important}
html[data-dh-theme="dark"] :is(.more-hero,.david-summary,.fin-hero,.hero11,.pro158-hero,.pro1510-hero,.fin153-hero,.hero156,.h145hero) :is(h2,h3,strong,b){color:#f5faff!important}
html[data-dh-theme="dark"] #app .bottom{background:#0d2030!important;border-color:#30475c!important}
html[data-dh-theme="dark"] #app .bottom .nav{background:transparent!important;color:#aebed0!important}
html[data-dh-theme="dark"] #app .bottom .nav.on{background:#17354d!important;color:#89c8ff!important}
html[data-dh-theme="dark"] #app .bottom .nav.on :is(b,.nav-icon153){color:#89c8ff!important}
html[data-dh-theme="dark"] .progress{background:#30465b!important}
html[data-dh-theme="dark"] :is(.tool13-formactions button,.tool13-photoedit .pick){box-shadow:none!important}
html[data-dh-theme="dark"] :is(.receipt156-total b,.tool13-price,.tool13-summary strong){color:var(--dh-dark-gold)!important}
/* Documentos oficiais: sempre brancos e legíveis, inclusive visualização no modo escuro */
html[data-dh-theme="dark"] :is(.report14,.r14doc,.receipt-print,.print-area){color:#10233d!important;background:#fff!important}
html[data-dh-theme="dark"] :is(.report14,.r14doc) :is(h1,h2,h3,h4,b,strong,small,span,p,div,td,th){color:inherit}
@media print{
  html[data-dh-theme="dark"]{color-scheme:light!important}
  html[data-dh-theme="dark"] :is(body,.report14,.r14doc,.print-area){background:#fff!important;color:#10233d!important}
}
/* Auditoria visual de cards legados (Início, Serviços e atalhos) */
html[data-dh-theme="dark"] .agenda156-open{
  background:#172e43!important;
  color:#f0f6fc!important;
  border:1px solid #365168!important;
  box-shadow:none!important;
}
html[data-dh-theme="dark"] .agenda156-open :is(b,.grow,.chev){color:#eef5fb!important}
html[data-dh-theme="dark"] .agenda156-open .icon{background:#304b4e!important;color:#f4d27d!important}
html[data-dh-theme="dark"] .h145quick button{
  background:#1c374d!important;color:#edf5ff!important;border-color:#36546b!important;
  box-shadow:none!important;
}
html[data-dh-theme="dark"] .h145quick button:first-child{background:#245876!important;color:#fff!important}
html[data-dh-theme="dark"] .h145quick button i{color:#f1cb77!important}
html[data-dh-theme="dark"] .service147card{
  background:#14283a!important;color:#f0f5fb!important;border:1px solid #32495d!important;
  box-shadow:none!important;
}
html[data-dh-theme="dark"] .service147card .grow :is(strong,small){color:#edf5fb!important}
html[data-dh-theme="dark"] .service147card .grow small{color:#b9c7d5!important}
html[data-dh-theme="dark"] .service147price{color:#f1c86e!important;font-weight:900!important}
html[data-dh-theme="dark"] .service147card :is(.edit12,.del12){
  border:1px solid #45667e!important;border-radius:10px!important;
  background:#213f56!important;color:#badfff!important;
  min-width:36px;min-height:36px;box-shadow:none!important;
}
html[data-dh-theme="dark"] .service147card .del12{background:#472c3c!important;color:#ffb4bd!important;border-color:#704858!important}
html[data-dh-theme="dark"] .fin153-report .ri{background:#243e52!important;color:#c9e9ff!important}
html[data-dh-theme="dark"] .invoice156-status :is(span,small,p){color:#b9c7d5!important}
html[data-dh-theme="dark"] .choicefooter152{background:#132739!important;border-color:#32495d!important}
html[data-dh-theme="dark"] .work1510.work-list-card{background:#14283a!important;border-left-color:var(--work-border,#dbb461)!important}
html[data-dh-theme="dark"] .choicepage152 :is(h2,h3,.choicehead152,.choiceback152){color:#edf5fc!important}
html[data-dh-theme="dark"] .tool13-form .tool13-photoedit .pick{background:#1d3a50!important;color:#d5eafa!important}

/* Checkboxes: neutraliza tamanho mínimo imposto nos inputs genéricos antigos */
html[data-dh-theme="dark"] :is(input[type="checkbox"],input[type="radio"]){min-height:0!important;appearance:auto!important;-webkit-appearance:auto!important;accent-color:#68b9fa!important}
html[data-dh-theme="dark"] .tool13-switch input[type="checkbox"]{width:22px!important;height:22px!important;flex:0 0 22px!important;margin:0!important}
html[data-dh-theme="dark"] .tool13-switch{align-items:center!important;gap:12px!important}
/* Resumos de valores nos formulários de orçamento e obra */
html[data-dh-theme="dark"] :is(.clean-summary152,.q148totals,.s147summary){background:#182f43!important;color:#eff6fc!important;border:1px solid #36546b!important}
html[data-dh-theme="dark"] :is(.clean-summary152 .sumline,.q148totals .q148line,.s147summary .line){color:#c7d5e2!important;border-color:#40596f!important}
html[data-dh-theme="dark"] :is(.clean-summary152 .sumline b,.q148totals .q148line b,.q148totals .q148line strong,.s147summary .line b){color:#f1c86e!important}
html[data-dh-theme="dark"] :is(.clean-summary152 .sumline.total,.q148totals .q148line.final){color:#f0f6fc!important;border-color:#466176!important}
html[data-dh-theme="dark"] .invoice156-scan p{color:#c3cfdd!important}
/* Ícones do Pró-Labore: retirar quadrados claros da interface escura */
html[data-dh-theme="dark"] :is(.pro1510-status i,.pro1510-row .pi,.pro158-status i,.pro158-row .pi){
  background:#244159!important;color:#bde1ff!important;border:1px solid #3e5b70!important;
}
html[data-dh-theme="dark"] .pro1510-row{background:#14283a!important;border-color:#344b60!important;color:#eff6fc!important}
html[data-dh-theme="dark"] :is(.pro1510-row b,.pro1510-status b){color:#f0f6fc!important}
html[data-dh-theme="dark"] :is(.pro1510-row small,.pro1510-status small){color:#bfcede!important}
