
/* Portulano 7.7.29 — tema global. O padrão é o tema do dispositivo; o botão permite override. */
:root[data-theme="dark"]{color-scheme:dark;--bg:#0e1412;--white:#151c19;--ink:#e7efeb;--ink-2:#c7d4cf;--muted:#91a39c;--line:#2b3732;--green:#b9dfd0;--green2:#71c8a8;--mint:#20362f;--amber:#e6ad59;--blue:#7eb4e8;--violet:#b09bd7;--shadow:0 10px 32px rgba(0,0,0,.28)}
:root[data-theme="dark"] body,:root[data-theme="dark"] .content{background:var(--bg);color:var(--ink)}
:root[data-theme="dark"] .topbar,:root[data-theme="dark"] .card,:root[data-theme="dark"] .metrics article,:root[data-theme="dark"] .modal-panel,:root[data-theme="dark"] .modal-footer,:root[data-theme="dark"] .postwork-case-card,:root[data-theme="dark"] .client-management-modal,:root[data-theme="dark"] .table-card,:root[data-theme="dark"] .workspace-toolbar,:root[data-theme="dark"] .company-switch-menu{background:#151c19!important;color:var(--ink);border-color:var(--line)!important}
:root[data-theme="dark"] input,:root[data-theme="dark"] select,:root[data-theme="dark"] textarea,:root[data-theme="dark"] .btn.outline,:root[data-theme="dark"] .modal-close,:root[data-theme="dark"] .dashboard-shortcut{background:#111815!important;color:var(--ink)!important;border-color:#34443d!important}
:root[data-theme="dark"] .postwork-case-card h3,:root[data-theme="dark"] .postwork-case-card p,:root[data-theme="dark"] .postwork-case-card small,:root[data-theme="dark"] .page-heading p,:root[data-theme="dark"] small{color:var(--muted)}
:root[data-theme="dark"] table th{background:#1b2521;color:#b6c7c0}:root[data-theme="dark"] table td{border-color:#29352f}:root[data-theme="dark"] tbody tr:hover td{background:#18211d}
:root[data-theme="dark"] .login-screen,:root[data-theme="dark"] .login-panel{background:#0e1412}:root[data-theme="dark"] .login-card h2{color:#dcebe5}:root[data-theme="dark"] .login-card input{background:#151c19;color:#e7efeb;border-color:#34443d}
:root[data-theme="dark"] .eng-empty{background:#141c18!important;color:#96a9a1!important;border-color:#2b3933!important}
.theme-toggle{display:grid;place-items:center;width:34px;height:34px;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--muted);font-size:15px;line-height:1;cursor:pointer;transition:.16s ease}.theme-toggle:hover{background:var(--mint);border-color:var(--line);color:var(--green2)}

/* 7.7.30 — revisão estrutural do tema escuro. Superfícies neutras; cores apenas para estados/ênfases. */
:root[data-theme="dark"]{
  --bg:#0f1317;--canvas:#0f1317;--white:#171c21;--surface:#171c21;--surface-2:#1d2329;--surface-3:#232a31;
  --ink:#eef2f0;--ink-2:#d5ddda;--muted:#97a39e;--line:#303840;--green:#68c3a2;--green2:#75cfad;--green-dark:#3d9d7b;--mint:#20322b;
  --shadow:0 14px 38px rgba(0,0,0,.28);--shadow-hover:0 18px 44px rgba(0,0,0,.36)
}
:root[data-theme="dark"] body,:root[data-theme="dark"] .app,:root[data-theme="dark"] main,:root[data-theme="dark"] .content,:root[data-theme="dark"] .view{background:var(--canvas)!important;color:var(--ink)}
:root[data-theme="dark"] .topbar,:root[data-theme="dark"] .sidebar{background:#12171b!important;border-color:#283039!important}
:root[data-theme="dark"] .card,:root[data-theme="dark"] .metrics article,:root[data-theme="dark"] .metric-filter,:root[data-theme="dark"] .table-card,:root[data-theme="dark"] .workspace-toolbar,:root[data-theme="dark"] .management-card,:root[data-theme="dark"] .compact-operation-card,:root[data-theme="dark"] .dashboard-request-card,:root[data-theme="dark"] .operation-summary,:root[data-theme="dark"] .form-card,:root[data-theme="dark"] .location-card,:root[data-theme="dark"] .stepper,:root[data-theme="dark"] .recent,:root[data-theme="dark"] .integration,:root[data-theme="dark"] .postwork-case-card,:root[data-theme="dark"] .client-management-modal,:root[data-theme="dark"] .modal-panel,:root[data-theme="dark"] .modal-footer,:root[data-theme="dark"] .company-switch-menu,:root[data-theme="dark"] .empty-state{background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important;box-shadow:none}
:root[data-theme="dark"] .metric-filter.active{background:#1d2b25!important;border-color:#4e9e81!important;box-shadow:inset 0 0 0 1px rgba(104,195,162,.12)}
:root[data-theme="dark"] .dashboard-request-card:hover,:root[data-theme="dark"] .compact-operation-card:hover,:root[data-theme="dark"] .management-card:hover,:root[data-theme="dark"] .postwork-case-card:hover{background:var(--surface-2)!important;border-color:#46534d!important;box-shadow:var(--shadow)!important}
:root[data-theme="dark"] h1,:root[data-theme="dark"] h2,:root[data-theme="dark"] h3,:root[data-theme="dark"] h4,:root[data-theme="dark"] strong,:root[data-theme="dark"] .dashboard-request-card>strong,:root[data-theme="dark"] .compact-operation-person strong,:root[data-theme="dark"] .operation-summary strong{color:var(--ink)!important}
:root[data-theme="dark"] p,:root[data-theme="dark"] small,:root[data-theme="dark"] .muted,:root[data-theme="dark"] .dashboard-request-card>small,:root[data-theme="dark"] .dashboard-request-kind,:root[data-theme="dark"] .compact-operation-person span,:root[data-theme="dark"] .dashboard-request-route,:root[data-theme="dark"] .operation-summary p{color:var(--muted)!important}
:root[data-theme="dark"] input,:root[data-theme="dark"] select,:root[data-theme="dark"] textarea,:root[data-theme="dark"] .search-input,:root[data-theme="dark"] .filter-input{background:#11171c!important;color:var(--ink)!important;border-color:#364049!important;box-shadow:none!important}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#76827d!important}
:root[data-theme="dark"] input:focus,:root[data-theme="dark"] select:focus,:root[data-theme="dark"] textarea:focus{border-color:#5eb493!important;outline:none!important;box-shadow:0 0 0 3px rgba(94,180,147,.12)!important}
:root[data-theme="dark"] .btn.outline,:root[data-theme="dark"] .btn.ghost,:root[data-theme="dark"] .icon-btn,:root[data-theme="dark"] .dashboard-shortcut,:root[data-theme="dark"] .modal-close{background:var(--surface-2)!important;color:var(--ink)!important;border-color:#3b454e!important}
:root[data-theme="dark"] .btn.outline:hover,:root[data-theme="dark"] .btn.ghost:hover,:root[data-theme="dark"] .icon-btn:hover{background:var(--surface-3)!important;border-color:#56635c!important}
:root[data-theme="dark"] table,:root[data-theme="dark"] tbody,:root[data-theme="dark"] tr{background:transparent!important}:root[data-theme="dark"] table th{background:#1b2228!important;color:#aeb9b4!important;border-color:var(--line)!important}:root[data-theme="dark"] table td{background:var(--surface)!important;color:var(--ink-2)!important;border-color:var(--line)!important}:root[data-theme="dark"] tbody tr:hover td{background:var(--surface-2)!important}
:root[data-theme="dark"] .dropzone,:root[data-theme="dark"] .tip,:root[data-theme="dark"] .ai-result,:root[data-theme="dark"] .detected,:root[data-theme="dark"] .location-data,:root[data-theme="dark"] .purchase-new-location,:root[data-theme="dark"] .attendance-auto-note{background:var(--surface-2)!important;border-color:var(--line)!important;color:var(--ink-2)!important}
:root[data-theme="dark"] .dashboard-purchases,:root[data-theme="dark"] .activity-row,:root[data-theme="dark"] .stepper>i{border-color:var(--line)!important;background-color:var(--line)}
:root[data-theme="dark"] .badge.open,:root[data-theme="dark"] .status.pending{background:#332718!important;color:#f0bc6d!important}:root[data-theme="dark"] .badge.done{background:#173126!important;color:#82d6aa!important}:root[data-theme="dark"] .status.planned{background:#192b3a!important;color:#8dbbe4!important}
:root[data-theme="dark"] .theme-toggle:hover{background:var(--surface-2)!important;border-color:#3d474f!important}
/* v7.8.0 · segurança e sessões */
.security-remember{display:flex!important;align-items:center;gap:9px!important;font-size:12px!important;color:var(--muted,#667085);cursor:pointer}.security-remember input{width:16px!important;height:16px!important;margin:0}.security-link{border:0;background:transparent;color:var(--green,#176b55);font:inherit;font-size:12px;font-weight:750;cursor:pointer;padding:4px 0}.security-link:hover{text-decoration:underline}.security-card{margin-top:16px}.security-card h2{margin:4px 0}.security-card p{margin:0;color:var(--muted,#667085);font-size:13px}.security-password-form{margin-top:16px}.security-session-list{display:grid;gap:10px;margin-top:14px}.security-session-row{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px;border:1px solid var(--border,#e4e7ec);border-radius:12px;background:var(--bg-surface,#fff)}.security-session-row>div{display:grid;gap:3px}.security-session-row small{color:var(--muted,#667085)}.security-current{display:inline-flex;width:max-content;padding:3px 7px;border-radius:999px;background:#e7f5ef;color:#176b55;font-size:10px;font-weight:800}.security-reset-form{display:grid;gap:14px}.security-reset-form label{display:grid;gap:6px}.security-reset-form input{width:100%;box-sizing:border-box}.security-modal-actions{display:flex;gap:8px;flex-wrap:wrap}.security-note{font-size:12px;color:var(--muted,#667085)}
:root[data-theme="dark"] .security-current{background:#17392f;color:#9bd9c5}

/* v8.0.7.4 — correção de contraste no modo escuro.
   Corrige superfícies internas que ainda mantinham fundos claros em Integrações,
   Pessoas/contatos externos, Minha Caixa, Suporte, Notificações, Atenção e modais de locais. */
:root[data-theme="dark"] .integration-provider-card,
:root[data-theme="dark"] .integration-mapping-card,
:root[data-theme="dark"] .integration-company-match,
:root[data-theme="dark"] .integration-map-row,
:root[data-theme="dark"] .integration-callout,
:root[data-theme="dark"] .reimbursement-profile-card,
:root[data-theme="dark"] .reimbursement-card,
:root[data-theme="dark"] .invoice-upload-box,
:root[data-theme="dark"] .ai-confirm-note,
:root[data-theme="dark"] .payment-confirm-card,
:root[data-theme="dark"] .detail-card,
:root[data-theme="dark"] .admin-review,
:root[data-theme="dark"] .installment-list>div,
:root[data-theme="dark"] .schedule-preview span{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .integration-company-match.matched,
:root[data-theme="dark"] .ai-confirm-note{
  background:#182720!important;
  border-color:#315244!important;
}
:root[data-theme="dark"] .integration-provider-head,
:root[data-theme="dark"] .integration-map-section,
:root[data-theme="dark"] .reimbursement-card-bottom,
:root[data-theme="dark"] .reimbursement-step,
:root[data-theme="dark"] .reimbursement-detail-head,
:root[data-theme="dark"] .detail-section,
:root[data-theme="dark"] .timeline-compact>div{
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .integration-logo{
  background:#21312b!important;
  color:#8ed4b8!important;
}
:root[data-theme="dark"] .integration-status{
  background:#272d31!important;
  color:#b8c3be!important;
}
:root[data-theme="dark"] .integration-status.ok,
:root[data-theme="dark"] .reimbursement-profile-status.ok,
:root[data-theme="dark"] .reimbursement-status.approved,
:root[data-theme="dark"] .reimbursement-status.approved_adjusted{
  background:#173126!important;
  color:#8ad7af!important;
}
:root[data-theme="dark"] .integration-status.error,
:root[data-theme="dark"] .reimbursement-status.rejected{
  background:#3a2322!important;
  color:#ef9d94!important;
}
:root[data-theme="dark"] .integration-callout.warning,
:root[data-theme="dark"] .reimbursement-profile-status,
:root[data-theme="dark"] .reimbursement-status.pending_approval{
  background:#332b19!important;
  color:#e5c06d!important;
}
:root[data-theme="dark"] .integration-callout.error,
:root[data-theme="dark"] .reimbursement-status.integration_error{
  background:#382622!important;
  color:#e7a079!important;
}

/* Diretório de pessoas e contatos externos */
:root[data-theme="dark"] .admin-directory-section + .admin-directory-section{
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .directory-person-card,
:root[data-theme="dark"] .client-internal-card,
:root[data-theme="dark"] .client-internal-summary-card,
:root[data-theme="dark"] .permission-option,
:root[data-theme="dark"] .media-library-item,
:root[data-theme="dark"] .project-planning-directory,
:root[data-theme="dark"] .project-planning-directory button{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .directory-person-card:hover,
:root[data-theme="dark"] .client-internal-card:hover,
:root[data-theme="dark"] .project-planning-directory button:hover{
  background:var(--surface-2)!important;
  border-color:#46534d!important;
}
:root[data-theme="dark"] .directory-person-card.is-inactive{
  background:#151a1e!important;
}
:root[data-theme="dark"] .directory-person-avatar{
  background:#20352d!important;
  color:#91d5bb!important;
}
:root[data-theme="dark"] .directory-person-avatar.external{
  background:#202d36!important;
  color:#9bc4d6!important;
}
:root[data-theme="dark"] .selected-project-note,
:root[data-theme="dark"] .permission-option:has(input:checked){
  background:#1b2a24!important;
  border-color:#3f6556!important;
}
:root[data-theme="dark"] .external-access-warning{
  background:#332b1d!important;
  color:#e6c98e!important;
}
:root[data-theme="dark"] .directory-modal-actions,
:root[data-theme="dark"] .modal-panel:has(.directory-modal-form){
  background:var(--surface)!important;
  border-color:var(--line)!important;
}

/* Minha Caixa / diretórios operacionais */
:root[data-theme="dark"] .inbox-role-section{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .inbox-role-section>header{
  background:var(--surface-2)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .inbox-directory-row{
  background:var(--surface)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .inbox-directory-row:hover{
  background:var(--surface-2)!important;
}
:root[data-theme="dark"] .inbox-role-section>header>b{
  background:#20362d!important;
  color:#83cdb0!important;
}

/* Suporte */
:root[data-theme="dark"] .support-user-picker-card,
:root[data-theme="dark"] .support-user-option{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .support-user-option:hover{
  background:var(--surface-2)!important;
  border-color:#547060!important;
}
:root[data-theme="dark"] [class*="support-"][class*="card"],
:root[data-theme="dark"] [class*="support-"][class*="panel"],
:root[data-theme="dark"] [class*="support-"][class*="row"]{
  border-color:var(--line)!important;
}

/* Notificações */
:root[data-theme="dark"] .notification-audience-selector,
:root[data-theme="dark"] .notification-all-warning,
:root[data-theme="dark"] .notification-compose-note,
:root[data-theme="dark"] .notification-item,
:root[data-theme="dark"] .notification-recipient-directory article,
:root[data-theme="dark"] .client-notification-row{
  background:var(--surface-2)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .notification-check:hover,
:root[data-theme="dark"] .notification-item:hover{
  background:var(--surface-3)!important;
}
:root[data-theme="dark"] .notification-item.unread{
  background:#192820!important;
  border-left-color:#68c3a2!important;
}
:root[data-theme="dark"] .notification-priority{
  background:#272d31!important;
  color:#bdc7c2!important;
}
:root[data-theme="dark"] .notification-priority.priority-important,
:root[data-theme="dark"] .priority-important .notification-priority{
  background:#362a19!important;
  color:#f0b968!important;
}
:root[data-theme="dark"] .notification-priority.priority-urgent,
:root[data-theme="dark"] .priority-urgent .notification-priority{
  background:#3a2322!important;
  color:#ef9b92!important;
}
:root[data-theme="dark"] .notification-bell{
  background:var(--surface-2)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .notification-unread-badge{border-color:#12171b!important}

/* Locais / Check-in e check-out */
:root[data-theme="dark"] .location-info-box,
:root[data-theme="dark"] .location-detail-modal,
:root[data-theme="dark"] .location-geocode-control,
:root[data-theme="dark"] .location-geocode-placeholder,
:root[data-theme="dark"] .location-geocode-result{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .location-stock-list,
:root[data-theme="dark"] .location-history-list,
:root[data-theme="dark"] .location-stock-row,
:root[data-theme="dark"] .location-history-row{
  border-color:var(--line)!important;
}
:root[data-theme="dark"] .location-history-row>span{
  background:#20362d!important;
  color:#8dd1b5!important;
}
:root[data-theme="dark"] .location-history-row.checkout>span{
  background:#202d39!important;
  color:#94bfe5!important;
}

/* Atenção / decisões / ações sugeridas e demais cards informativos */
:root[data-theme="dark"] .attention-summary-grid article,
:root[data-theme="dark"] .attention-alert,
:root[data-theme="dark"] .engineering-intelligence-card,
:root[data-theme="dark"] .engineering-analytical-row,
:root[data-theme="dark"] .media-library-item div{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .attention-alert:hover,
:root[data-theme="dark"] .engineering-analytical-row:hover{
  background:var(--surface-2)!important;
}
:root[data-theme="dark"] .schedule-history-track{background:#2d3732!important}

/* Texto secundário: evita cinza escuro sobre superfície escura. */
:root[data-theme="dark"] .integration-provider-head p,
:root[data-theme="dark"] .integration-fields small,
:root[data-theme="dark"] .integration-company-match span,
:root[data-theme="dark"] .integration-company-match small,
:root[data-theme="dark"] .integration-callout,
:root[data-theme="dark"] .external-access-heading p,
:root[data-theme="dark"] .external-project-picker,
:root[data-theme="dark"] .directory-person-main p,
:root[data-theme="dark"] .directory-person-main small,
:root[data-theme="dark"] .directory-person-meta small,
:root[data-theme="dark"] .selected-project-note small,
:root[data-theme="dark"] .directory-modal-heading p,
:root[data-theme="dark"] .directory-modal-fields>label,
:root[data-theme="dark"] .directory-modal-fields label small,
:root[data-theme="dark"] .permission-option small,
:root[data-theme="dark"] .notification-item p,
:root[data-theme="dark"] .location-box-head>small,
:root[data-theme="dark"] .location-stock-row small,
:root[data-theme="dark"] .location-history-row small,
:root[data-theme="dark"] .location-empty{
  color:var(--muted)!important;
}


/* ==========================================================================
   Portulano v8.0.7.5 — dark mode transversal\n   Corrige superfícies claras remanescentes sem alterar regras de negócio.
   ========================================================================== */
:root[data-theme="dark"]{
  --pt-dark-card:#171e22;
  --pt-dark-card-2:#1b2428;
  --pt-dark-card-3:#202b2f;
  --pt-dark-border:#334047;
  --pt-dark-text:#edf3f0;
  --pt-dark-muted:#9aa9a3;
}

/* Estrutura da empresa / Obras e locais */
:root[data-theme="dark"] .location-directory-card,
:root[data-theme="dark"] .location-directory-table-head,
:root[data-theme="dark"] .location-directory-row,
:root[data-theme="dark"] .location-directory-empty{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
}
:root[data-theme="dark"] .location-directory-table-head{background:var(--pt-dark-card-2)!important;color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .location-directory-row:hover{background:var(--pt-dark-card-2)!important}
:root[data-theme="dark"] .location-directory-row strong{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .location-directory-cnpj,
:root[data-theme="dark"] .location-directory-address{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .location-directory-row.is-archived{opacity:.78}
.location-directory-heading-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.location-archive-toggle{display:inline-flex;align-items:center;gap:7px}
.location-archive-toggle svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
.location-archive-toggle.active{border-color:#6cbda0!important;background:#1c342b!important;color:#9de1c7!important}
.location-archived-badge{display:inline-flex;margin-left:8px;padding:2px 7px;border-radius:999px;background:#e8ecea;color:#53615c;font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
:root[data-theme="dark"] .location-archived-badge{background:#2b3438;color:#bec9c4}
.location-detail-title-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.location-archive-action{border-color:#d0a89f!important;color:#985043!important}
.location-archive-action.restore{border-color:#75ad98!important;color:#277057!important}
:root[data-theme="dark"] .location-archive-action{border-color:#86584f!important;color:#e1a69b!important}
:root[data-theme="dark"] .location-archive-action.restore{border-color:#477a67!important;color:#96d7bd!important}

/* Painel de Engenharia + cards de planejamento */
:root[data-theme="dark"] #view-engineering-dashboard .card,
:root[data-theme="dark"] .engineering-dashboard-card,
:root[data-theme="dark"] .engineering-kpi-card,
:root[data-theme="dark"] .planning-project-card,
:root[data-theme="dark"] .planning-project-indicators span{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .planning-project-card h2,
:root[data-theme="dark"] .planning-project-indicators b{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .planning-project-card p,
:root[data-theme="dark"] .planning-project-card em,
:root[data-theme="dark"] .planning-project-indicators small{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .planning-project-indicators .late{background:#2a201e!important;border-color:#73473f!important}
:root[data-theme="dark"] .planning-project-indicators .late b{color:#ef9a89!important}

/* Carteira de Obras */
:root[data-theme="dark"] .eng-project-card,
:root[data-theme="dark"] .engineering-project-card,
:root[data-theme="dark"] [class*="project-card"]:not(.project-calendar-day):not(.project-calendar-event-row){
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .eng-project-card h2,
:root[data-theme="dark"] .engineering-project-card h2{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .eng-project-card p,
:root[data-theme="dark"] .engineering-project-card p{color:var(--pt-dark-muted)!important}

/* Dias chuvosos */
:root[data-theme="dark"] .rainy-toolbar,
:root[data-theme="dark"] .rainy-locality-card,
:root[data-theme="dark"] .rainy-summary article,
:root[data-theme="dark"] .rainy-month,
:root[data-theme="dark"] .rainy-detail-grid article{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
}
:root[data-theme="dark"] .rainy-toolbar label,
:root[data-theme="dark"] .rainy-locality-card label,
:root[data-theme="dark"] .rainy-locality-card small,
:root[data-theme="dark"] .rainy-summary span{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .rainy-day{background:var(--pt-dark-card-2)!important;color:var(--pt-dark-text)!important;border-color:var(--pt-dark-border)!important}
:root[data-theme="dark"] .rainy-day:hover{background:var(--pt-dark-card-3)!important}

/* Portal do Cliente / gestão contratual */
:root[data-theme="dark"] .client-internal-summary-card,
:root[data-theme="dark"] .client-internal-tabs,
:root[data-theme="dark"] .client-internal-card,
:root[data-theme="dark"] .client-internal-toolbar{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .client-internal-tabs button{color:var(--pt-dark-muted)!important;background:transparent!important}
:root[data-theme="dark"] .client-internal-tabs button.active{background:var(--pt-dark-card-3)!important;color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .client-internal-summary-card span,
:root[data-theme="dark"] .client-internal-card p,
:root[data-theme="dark"] .client-internal-card small{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .client-internal-summary-card strong,
:root[data-theme="dark"] .client-internal-card h3{color:var(--pt-dark-text)!important}

/* Intelligence / dashboard executivo */
:root[data-theme="dark"] .intelligence-dashboard-content,
:root[data-theme="dark"] .intelligence-dashboard-content>section,
:root[data-theme="dark"] .engineering-intelligence-card,
:root[data-theme="dark"] .engineering-analytical-row{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
}
:root[data-theme="dark"] .engineering-intelligence-card span,
:root[data-theme="dark"] .engineering-analytical-row small{color:var(--pt-dark-muted)!important}

/* Cards genéricos que ainda traziam branco em dashboards/engenharia */
:root[data-theme="dark"] #view-engineering-dashboard [class*="metric"],
:root[data-theme="dark"] #view-engineering-dashboard [class*="summary"] article,
:root[data-theme="dark"] #view-intelligence [class*="metric"],
:root[data-theme="dark"] #view-intelligence [class*="summary"] article{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
}

/* Mapa Leaflet: controles/popup acompanham o tile escuro. */
:root[data-theme="dark"] .materials-map-card,
:root[data-theme="dark"] .materials-map-toolbar,
:root[data-theme="dark"] .materials-map-detail{background:var(--pt-dark-card)!important;border-color:var(--pt-dark-border)!important;color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .leaflet-control-zoom a{background:#1c2529!important;color:#eef3f1!important;border-color:#344149!important}
:root[data-theme="dark"] .leaflet-control-zoom a:hover{background:#273238!important}
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip{background:#1b2428!important;color:#edf3f0!important}
:root[data-theme="dark"] .leaflet-popup-content small,
:root[data-theme="dark"] .leaflet-popup-content span{color:#aab7b1!important}
:root[data-theme="dark"] .leaflet-control-attribution{background:rgba(20,27,31,.82)!important;color:#aeb9b4!important}
:root[data-theme="dark"] .leaflet-control-attribution a{color:#8fcdb6!important}

/* Complemento específico: Painel ENG e Intelligence Hub */
:root[data-theme="dark"] #view-engineering .eng-metric,
:root[data-theme="dark"] #view-engineering .eng-project-card,
:root[data-theme="dark"] #view-engineering-projects .eng-project-card,
:root[data-theme="dark"] #view-engineering .eng-progress-row div{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] #view-engineering .eng-progress-row div{background:var(--pt-dark-card-2)!important}
:root[data-theme="dark"] #view-engineering .eng-metric span,
:root[data-theme="dark"] #view-engineering .eng-metric small,
:root[data-theme="dark"] #view-engineering .eng-project-owner span,
:root[data-theme="dark"] #view-engineering .eng-progress-row span{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] #view-engineering .eng-metric strong,
:root[data-theme="dark"] #view-engineering .eng-project-owner strong,
:root[data-theme="dark"] #view-engineering .eng-project-card h3{color:var(--pt-dark-text)!important}

:root[data-theme="dark"] .hub-command-card{
  background:linear-gradient(135deg,#171e22 0%,#1a2523 100%)!important;
  border-color:var(--pt-dark-border)!important;
  color:var(--pt-dark-text)!important;
}
:root[data-theme="dark"] .hub-command-card h2,
:root[data-theme="dark"] .hub-module-heading h2{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .hub-command-card p,
:root[data-theme="dark"] .hub-module-heading p,
:root[data-theme="dark"] .hub-metric small{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .hub-command-status>span{background:#22312d!important;color:#b8d8cc!important}
:root[data-theme="dark"] .hub-command-status>span.danger{background:#392522!important;color:#f2aaa0!important}
:root[data-theme="dark"] .hub-command-status>span.good{background:#1d3329!important;color:#95d7ba!important}
:root[data-theme="dark"] .hub-module-card,
:root[data-theme="dark"] .hub-metric,
:root[data-theme="dark"] .hub-list{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .hub-list-heading>span{background:#293438!important;color:#c1ccc7!important}
:root[data-theme="dark"] .hub-list article{border-color:var(--pt-dark-border)!important}
:root[data-theme="dark"] .hub-list article b{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .hub-secondary-heading{border-color:var(--pt-dark-border)!important}


/* v8.0.7.6 — diretórios de pessoas no modo escuro */
:root[data-theme="dark"] #users-directory,
:root[data-theme="dark"] #external-access-directory{
  background:var(--pt-dark-card)!important;
  border-color:var(--pt-dark-border)!important;
}
:root[data-theme="dark"] .people-directory-row,
:root[data-theme="dark"] .external-directory-row{
  background:var(--pt-dark-card)!important;
  color:var(--pt-dark-text)!important;
  border-color:var(--pt-dark-border)!important;
}
:root[data-theme="dark"] .people-directory-row.is-clickable:hover,
:root[data-theme="dark"] .external-directory-row:hover{background:var(--pt-dark-card-2)!important}
:root[data-theme="dark"] .people-directory-identity p,
:root[data-theme="dark"] .external-directory-identity p,
:root[data-theme="dark"] .people-directory-summary strong,
:root[data-theme="dark"] .external-directory-summary>span{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .people-directory-identity small,
:root[data-theme="dark"] .external-directory-identity small,
:root[data-theme="dark"] .people-directory-summary small,
:root[data-theme="dark"] .external-directory-summary small{color:var(--pt-dark-muted)!important}
:root[data-theme="dark"] .people-directory-summary,
:root[data-theme="dark"] .external-directory-summary{border-color:var(--pt-dark-border)!important}
:root[data-theme="dark"] .people-directory-open,
:root[data-theme="dark"] .external-directory-open{color:#8bd7ba!important}

/* Calendário da obra — cabeçalho obrigatoriamente em três linhas */
:root[data-theme="dark"] .eng-calendar-page-head{border-color:var(--pt-dark-border)!important}
:root[data-theme="dark"] .eng-calendar-page-head h2{color:var(--pt-dark-text)!important}
:root[data-theme="dark"] .eng-calendar-page-head p{color:var(--pt-dark-muted)!important}

/* v8.0.7.7 — SharePoint dark mode */
html[data-theme="dark"] .sharepoint-provider-card,
html[data-theme="dark"] .eng-sharepoint-empty,
html[data-theme="dark"] .eng-sharepoint-browser{background:#17201c;border-color:#33413a}
html[data-theme="dark"] .sharepoint-connection-summary>div,
html[data-theme="dark"] .eng-sharepoint-loading,
html[data-theme="dark"] .eng-sharepoint-error,
html[data-theme="dark"] .sharepoint-picker-path{background:#1c2722;border-color:#33413a;color:#aebdb5}
html[data-theme="dark"] .eng-sharepoint-item,
html[data-theme="dark"] .sharepoint-picker-folder{border-color:#2c3933;color:#e6eee9}
html[data-theme="dark"] .eng-sharepoint-item:hover,
html[data-theme="dark"] .sharepoint-picker-folder:hover{background:#202d27}
html[data-theme="dark"] .sp-file-icon,
html[data-theme="dark"] .integration-logo-sharepoint{background:#213129;color:#72c89d}
html[data-theme="dark"] .sharepoint-picker-directory{border-color:#33413a;background:#17201c}
