/* Dernière couche de palette : les surfaces communes suivent le mode choisi. */
@media screen{
 body.dark-mode{
  color-scheme:dark;
  --surface:#172231;--panel:#172231;--card:#172231;--text:#e7edf5;--border:#40536b;
  --pale:#1d2a3a;--line:#40536b;--ink:#e7edf5;--muted:#b6c4d5;
  --list-header-bg:#24384e;--list-header-ink:#dbe6f2;--list-border:#52677e;
  --list-client-blue:#91caff;--list-equipment-color:#d6b0ff;
 }
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(.panel-body,.record-tab-panel,.aw-tab-body,.aw-main,.aw-card,.np-body,.np-equipment-details,.np-site-card,.nc-site-wifi,.nc-radio-card,#automationBody,#qsPanel,.qs-main,.ops-panel,.ops-card,.preventive-modal-body,.pv-check-editor,.pv-result,.pv-evidence,.ink-rich-section,#softwareDeploymentBody,.mib-test-panel){
  background:#172231!important;color:#e7edf5!important;
  --ink:#e7edf5;--muted:#b6c4d5;--navy:#b9d8f5;--line:#40536b;--pale:#1d2a3a;
  --panel:#172231;--surface:#172231;--card:#172231;--text:#e7edf5;--border:#40536b;
 }
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(.aw-tabs,.record-tabs,.np-tabs,.monitor-tabs,.automation-tabs,.qs-tabs,.ops-tabs,.pv-tabs,.ink-view-tabs,.software-deployment-tabs,.time-project-tabs){background:#111b27!important;border-color:#40536b!important}
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(.aw-tabs,.record-tabs,.np-tabs,.monitor-tabs,.automation-tabs,.qs-tabs,.ops-tabs,.pv-tabs,.ink-view-tabs,.software-deployment-tabs,.time-project-tabs)>button{
  background:#24384e!important;color:#e7edf5!important;border-color:#40536b!important;
 }
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(.aw-tabs,.record-tabs,.np-tabs,.monitor-tabs,.automation-tabs,.qs-tabs,.ops-tabs,.pv-tabs,.ink-view-tabs,.software-deployment-tabs,.time-project-tabs)>button:is(.active,[aria-selected="true"],[aria-pressed="true"]){
  background:#172231!important;color:#b9e6ff!important;border-top-color:#72c8df!important;border-bottom-color:#172231!important;
 }
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(.aw-card h3,.aw-summary strong,.aw-record-identity strong,.qs-inspector p,.aw-facts dt,.aw-facts dd){color:#e7edf5!important}
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not(.rich-notes-source){background:#111b27!important;color:#e7edf5!important;border-color:#60758d!important}
 body.dark-mode :is(input,select,textarea){color-scheme:dark!important}
 body.dark-mode :is(select option,select optgroup){background:#111b27!important;color:#e7edf5!important}
 body.dark-mode :is(#content,dialog,#clientPilotHost) :is(input,textarea)::placeholder{color:#b6c4d5!important;opacity:1}
 html body.dark-mode #detailDialog #clientPilotForm :is(input,select,textarea):disabled{background:#202e40!important;color:#dbe6f2!important;border-color:#40536b!important}
 body.dark-mode .topbar{background:#172231!important;color:#e7edf5!important;border-color:#40536b!important}
 body.dark-mode .topbar #pageTitle{color:#e7edf5!important}
 body.dark-mode .topbar :is(#pageSubtitle,.sync-group>span:first-child){color:#b6c4d5!important}
 body.dark-mode :is(.global-search,.selection-context,.entity-list-controls,.column-options,.detail-more-menu,.aw-manage-options,.selection-more-menu){background:#1d2a3a!important;color:#e7edf5!important;border-color:#40536b!important}
 body.dark-mode :is(.phonebook-table,.phonebook-table tbody tr) td{background:#172231;color:#e7edf5}
 body.dark-mode .phonebook-table tbody tr:nth-child(even) td{background:#1d2a3a}
 body.dark-mode .phonebook-table tbody tr:hover td{background:#243b55}
 body.dark-mode :is(.aa-dialog,.aa-prompt,.aa-toolbar,.aa-editor,.aa-prompt footer,.phonebook-card,.view-switch,.calendar-week-grid>div){background:#172231;color:#e7edf5;border-color:#40536b}
 body.dark-mode :is(.aa-selection span,.aa-actions>span,.aa-footer,.aa-editor summary,.aa-prompt summary,.phonebook-card small){color:#b6c4d5}
 body.dark-mode :is(.aa-client,.phonebook-card strong){color:#91caff}
 body.dark-mode .aa-name{color:#80e3be}
 body.dark-mode :is(.aa-page,.aa-rows) th{background:#24384e;color:#dbe6f2;border-color:#40536b}
 body.dark-mode :is(.aa-page,.aa-rows) tr.selected{background:#244768}
 body.dark-mode .calendar-week-grid :is(.week-heading,.week-corner){background:#24384e;color:#dbe6f2}
 body.dark-mode .calendar-week-grid .week-heading.selected{background:#185b85;color:#fff}
 body.dark-mode .view-switch button{color:#e7edf5}
 body.dark-mode .view-switch button[aria-pressed=true]{background:#185b85;color:#fff}
 body.dark-mode button.waze-button{background:#24384e;border-color:#73aabd}
 body.dark-mode button.waze-button:hover:not(:disabled){background:#34516b}
 body.dark-mode #clientPilotError{background:#502729;color:#ffd5d5;border-color:#a86969}
 /* Les notes mises en forme conservent une feuille claire et leurs couleurs d'auteur. */
 body.dark-mode :is(.rich-notes-editor,.ink-rich-editor,.rich-notes-display){background:#fff;color:#172b40}
 #clientPilotForm [hidden]{display:none!important}
 #clientPilotForm .linked-records{margin-top:16px}
 #clientPilotForm .linked-records tbody tr{cursor:pointer}
 #clientPilotForm .linked-records tr:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}
 #clientPilotForm .linked-records .table-wrap{max-height:45dvh;overflow:auto}
 #clientPilotForm .linked-records thead{position:sticky;top:0;z-index:1}
}
