/* Shared appearance contract. Status, safety and relationship colours retain
   their existing meaning; maps, photos and customer logos are never filtered. */
:root[data-orq-theme="dark"] {
  color-scheme: dark;
  --orq-appearance-canvas:#07111f;
  --orq-appearance-panel:#111f33;
  --orq-appearance-subtle:#17283f;
  --orq-appearance-text:#edf3fc;
  --orq-appearance-muted:#afbed2;
  --orq-appearance-line:#34465f;
  --orq-appearance-link:#8dc5ff;
}
:root[data-orq-theme="light"] {
  color-scheme: light;
  --orq-appearance-canvas:#f4f7fb;
  --orq-appearance-panel:#ffffff;
  --orq-appearance-subtle:#edf2f8;
  --orq-appearance-text:#162238;
  --orq-appearance-muted:#52647b;
  --orq-appearance-line:#cbd5e1;
  --orq-appearance-link:#1d4ed8;
}
:root[data-orq-theme] {
  --orq-ink:var(--orq-appearance-text);
  --orq-ink-strong:var(--orq-appearance-text);
  --orq-muted:var(--orq-appearance-muted);
  --orq-line:var(--orq-appearance-line);
  --orq-field-line:var(--orq-appearance-line);
  --orq-panel:var(--orq-appearance-panel);
  --orq-surface-canvas:var(--orq-appearance-canvas);
  --orq-surface-raised:var(--orq-appearance-panel);
  --orq-surface-subtle:var(--orq-appearance-subtle);
  --orq-surface-dark-raised:var(--orq-appearance-panel);
  --orq-border-default:var(--orq-appearance-line);
  --orq-border-strong:var(--orq-appearance-line);
  --orq-action-secondary-bg:var(--orq-appearance-panel);
  --orq-action-secondary-hover:var(--orq-appearance-subtle);
  --orq-action-secondary-fg:var(--orq-appearance-text);
  --orq-ui-text:var(--orq-appearance-text);
  --orq-ui-muted:var(--orq-appearance-muted);
  --orq-ui-line:var(--orq-appearance-line);
  --orq-ui-surface:var(--orq-appearance-panel);
  --bg:var(--orq-appearance-canvas);
  --panel:var(--orq-appearance-panel);
  --text:var(--orq-appearance-text);
  --ink:var(--orq-appearance-text);
  --muted:var(--orq-appearance-muted);
  --line:var(--orq-appearance-line);
}
html:root[data-orq-theme][data-orq-appearance] body {
  background:var(--orq-appearance-canvas) !important;
  color:var(--orq-appearance-text) !important;
}
/* Neutral surfaces shared by the existing operational and administration pages. */
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-app-header,.orq-global-hero,.orq-app-menu,.menu-drawer,.panel,.card,.surface,.section-card,.summary-card,.profile-card,.activity-card,.insight-card,.tool-card,.orq-surface-card,.orq-modal-surface,.modal-card,.modal-content,.diary-job-modal,.filters-panel,.auth-panel,.trust-panel,.entry,.login-panel,.orq-report-modal) {
  background:var(--orq-appearance-panel) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-app-header__title h1,.orq-global-hero h1,.panel-title,.profile-card-title,.summary-value,.section-title,.orq-report-title,.menu-title,.orq-app-menu__title) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-muted,.muted,.sub,.hint,.summary-label,.summary-sub,.panel-sub,.profile-card-sub,.orq-home-intro,.field-label,.orq-field__label,.label,.orq-app-menu__heading) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-app-header__menu,.orq-app-menu__close,.menu-close,.menu-item,.orq-app-menu__logout,.menu-logout,.orq-home-shortcuts a,.orq-button--secondary,.secondary-btn,.filter-toggle-btn,.filter-action-btn) {
  background:var(--orq-appearance-subtle) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(.menu-item-title,.menu-item-arrow) {color:inherit !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]),select,textarea) {
  background-color:var(--orq-appearance-panel) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(input,textarea)::placeholder {color:var(--orq-appearance-muted);opacity:1;}
html:root[data-orq-theme][data-orq-appearance] body :is(input,select,textarea):disabled {opacity:.65;}
html:root[data-orq-theme][data-orq-appearance] body :is(table,.table-wrap) {color:var(--orq-appearance-text) !important;background:var(--orq-appearance-panel) !important;}
html:root[data-orq-theme][data-orq-appearance] body th {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body td {color:inherit !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body tbody tr:not(.row-overdue):not(.row-critical):not(.row-at-risk):not(.selected):not(.active) {background:var(--orq-appearance-panel);color:var(--orq-appearance-text);}
html:root[data-orq-theme="dark"][data-orq-appearance] body tbody tr:is(.row-overdue,.row-critical,.row-at-risk) {color:#162238;}
.orq-appearance-control {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 10px;font:400 12px/1.4 Inter,system-ui,sans-serif;color:var(--orq-appearance-text);}
.orq-appearance-control select {min-height:38px;min-width:100px;padding:7px 10px;border:1px solid var(--orq-appearance-line);border-radius:8px;font:inherit;}
.orq-appearance-control select:focus-visible {outline:3px solid #60a5fa;outline-offset:2px;}
.orq-brand-logo {display:inline-flex;align-items:center;width:190px;max-width:100%;flex:none;}
.orq-brand-logo img {display:block;width:100%;height:auto;max-height:52px;object-fit:contain;}
.orq-brand-logo .orq-brand-logo__light {display:none;}
html[data-orq-theme="light"] .orq-brand-logo .orq-brand-logo__dark {display:none;}
html[data-orq-theme="light"] .orq-brand-logo .orq-brand-logo__light {display:block;}
.orq-global-hero-mark:has(.orq-brand-logo) {width:190px !important;height:auto !important;background:none !important;box-shadow:none !important;}
.orq-global-hero-mark .orq-brand-logo img {width:100% !important;height:auto !important;}
@media(max-width:820px) {
  .orq-app-header__brand .orq-brand-logo {width:120px;}
  .orq-app-header__brand {flex-wrap:wrap;gap:5px !important;}
}
@media(max-width:520px) {
  .orq-app-header__brand .orq-brand-logo {width:92px;}
  .orq-app-header__brand .orq-demo-badge {font-size:8px;min-height:18px;padding:0 6px;}
}
@media print {
  html:root[data-orq-theme][data-orq-appearance] body {background:#fff !important;color:#111827 !important;}
  .orq-appearance-control {display:none;}
}

/* Remaining shared legacy surfaces and text roles. */
html:root[data-orq-theme][data-orq-appearance] body :is(.table-panel,.posture-card,.workspace,.activity-item,.insight-row,.job-date-filter,.cw-panel,.cw-toolbar) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.activity-title,.insight-value,.hero h1,.workspace-intro h2,.cw-status,.trust-panel p,.trust-note,.safe-note,.safe-note span,.safe-note strong,.future strong,.ops-standard-views label) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.activity-meta,.activity-time,.insight-label,.mini-menu-label,.job-date-filter-title small,.brand-sub,.mode-tab) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-demo-badge,.orq-demo-hero-badge) {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;box-shadow:none;}
html:root[data-orq-theme][data-orq-appearance] body :is(.hero-btn,.logout,.create-link) {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .eyebrow {color:#1d4ed8 !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body :is(.value.bad,.posture-value.bad) {color:#b91c1c !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body :is(.value.warn,.posture-value.warn,.warning) {color:#92400e !important;}
.orq-appearance-standalone {position:fixed;right:16px;top:14px;z-index:1000;border-radius:12px;background:var(--orq-appearance-panel);border:1px solid var(--orq-appearance-line);}
body:has(.orq-appearance-standalone) > main {padding-top:76px;}
body:has(.hero-stage) > .orq-appearance-standalone {top:auto;bottom:16px;}
html:root[data-orq-theme][data-orq-appearance] body .hero-stage {background:radial-gradient(ellipse at center, var(--orq-appearance-subtle),var(--orq-appearance-canvas)) !important;}

/* Text and neutral detail panels used by account, field and owner workflows. */
html:root[data-orq-theme][data-orq-appearance] body :is(.detail,.quick-card,.mini-menu-card,.mode-tabs,.mode-tab,.field-label,.user-grid-head,.visitor-toolbar,.fact,.note,.safe,.activation) {background:var(--orq-appearance-subtle) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.intro,.fact,.fact strong,.field label,.detail-value,.quick-value,.lone-self-title,.mini-menu-card span,.mywork-map-title,.status-break-value,.brief-text,.visitor-toolbar__heading h2,.visitor-toolbar__policy label,.planner-page-title,.features span,.entry p,.panel h1,.brand strong,.brand span,.future p strong) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.detail-note,.hero-meta span,.quick-label,.quick-note,.section-sub,.lone-self-kicker,.mini-menu-card small,.mywork-map-sub,.job-ticket-filter span,.job-filter-summary,.status-break-text,.view-sub,.user-grid-head div,.visitor-toolbar__heading p,.cw-help,.hero-sub,.foot,.brand-sub) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.back,.actions a,.menu-btn,.planner-tool-btn,.tab:not(.active)) {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.eyebrow,.brief-kicker,.ref) {color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme][data-orq-appearance] body .tab .badge {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body .mode-tab.active {color:var(--orq-appearance-link) !important;border-color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme][data-orq-appearance] body .brand-bottom .orq-brand-logo {width:100%;}

/* Shared legacy hero constraints previously assumed a square Q mark. */
html:root[data-orq-theme][data-orq-appearance] body .orq-brand-lockup {min-width:0 !important;max-width:none !important;width:auto !important;gap:12px !important;}
html:root[data-orq-theme][data-orq-appearance] body .orq-global-hero-mark {width:190px !important;min-width:0 !important;max-width:190px !important;height:auto !important;min-height:0 !important;max-height:none !important;flex:0 0 190px !important;filter:none !important;}
html:root[data-orq-theme][data-orq-appearance] body .orq-brand-logo img {width:100% !important;min-width:0 !important;max-width:100% !important;height:auto !important;min-height:0 !important;max-height:52px !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .orq-brand-logo__light,
html:root[data-orq-theme="light"][data-orq-appearance] body .orq-brand-logo__dark {display:none !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .orq-brand-logo__dark,
html:root[data-orq-theme="light"][data-orq-appearance] body .orq-brand-logo__light {display:block !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.lone-self-panel,.mywork-map-head,.job-filter-bar,.small-table td,.empty,.bucket,.calendar-card,.calendar-grid,.lane) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
@media(max-width:600px) {
 html:root[data-orq-theme][data-orq-appearance] body .orq-global-hero-mark {width:140px !important;max-width:140px !important;flex-basis:140px !important;}
 html:root[data-orq-theme][data-orq-appearance] body .orq-global-hero-mark .orq-brand-logo {width:140px;}
}

html:root[data-orq-theme][data-orq-appearance] body :is(.mywork-mini-menu,.small-table tr) {background:var(--orq-appearance-panel) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body :is(.orq-app-header,.orq-global-hero,.panel,.card,.surface,.section-card,.summary-card,.profile-card,.activity-card,.insight-card,.tool-card,.lone-self-panel) {box-shadow:0 5px 18px rgba(15,23,42,.06) !important;}

/* Operations has sticky-column rules with deliberately high specificity. */
html:root[data-orq-theme][data-orq-appearance] body.orq-ops-page .table-wrap thead :is(th,[data-orq-col]),
html:root[data-orq-theme][data-orq-appearance] body.orq-ops-page .engineer-locations-table th {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body.orq-ops-page .table-wrap td,
html:root[data-orq-theme][data-orq-appearance] body.orq-ops-page .engineer-locations-table td {background:inherit !important;color:inherit !important;}
html:root[data-orq-theme][data-orq-appearance] body #toggleFiltersBtn {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;}
@media(max-width:600px) {
 html:root[data-orq-theme][data-orq-appearance] body.orq-app-v2 .orq-app-header {grid-template-columns:minmax(0,1fr) auto;gap:6px;}
 html:root[data-orq-theme][data-orq-appearance] body .orq-app-header__title {grid-column:1/-1;grid-row:2;}
 html:root[data-orq-theme][data-orq-appearance] body .orq-app-header__brand .orq-brand-logo {width:140px;}
}

html:root[data-orq-theme][data-orq-appearance] body :is(.create-modal,.edit-modal,.profile-modal,.modal-structured-section,.action-panel) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.note,.safe,.activation,.page strong) {color:var(--orq-appearance-text) !important;}

/* Authentication dialogs retain their existing interactions in both palettes. */
html:root[data-orq-theme][data-orq-appearance] body :is(.login-modal,.access-modal) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.login-modal label,.access-field,.access-title,.access-label,.access-note,.access-confirmation p,.confirmation-meta) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.close-modal,.modal-lock,.access-btn:not(.primary)) {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body .modal-lock svg {stroke:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.login-link-btn,.forgot-message) {color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .required-star {color:#b91c1c !important;}

/* Live Demo acceptance: contrast on legacy map, Scheduler and account headings. */
html:root[data-orq-theme][data-orq-appearance] body :is(.account-hero,.scheduler-allocation-details > summary) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.map-panel-title,.account-hero h2,#schedulerContractControls) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body #schedulerContractControls > span {color:var(--orq-appearance-muted) !important;}

/* Map overlays remain a light reading surface in either appearance palette.
   Scoped colour tokens only: typography, tiles and operational colours are unchanged. */
html:root[data-orq-theme][data-orq-appearance] body :is(.orq-map-control,.orq-map-legend-card,.leaflet-popup-content-wrapper,.leaflet-tooltip) {
  color-scheme:light;
  --orq-ink:#162238; --orq-ink-strong:#162238; --orq-muted:#52647b;
  --orq-appearance-text:#162238; --orq-appearance-muted:#52647b;
  --orq-appearance-panel:#fff; --orq-appearance-subtle:#edf2f8;
  --orq-appearance-line:#cbd5e1; --orq-appearance-link:#1d4ed8;
  color:#162238 !important; background:#fff !important;
}
/* Matching contrast repair on the four reviewed administration pages. */
html:root[data-orq-theme="dark"][data-orq-appearance] body :is(.orq-master-context,.orq-master-context__metric,.orq-master-site-notes,.cr-coverage,.cr-region) {background:var(--orq-appearance-subtle);color:var(--orq-appearance-text);border-color:var(--orq-appearance-line);}
html:root[data-orq-theme="dark"][data-orq-appearance] body .orq-master-site-item:is([aria-selected="true"],:hover) {background:var(--orq-appearance-panel);}
html:root[data-orq-theme="dark"][data-orq-appearance] body :is(.cw-disclosure-toggle,.cw-section legend) {color:var(--orq-appearance-text);}
html:root[data-orq-theme="dark"][data-orq-appearance] body :is(.cw-disclosure-summary,.cr-legend,.cr-muted) {color:var(--orq-appearance-muted);}
/* Give the name its own line; a long contract code must not squeeze it away. */
body.cw-page .cw-contract-item {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;align-items:start;}
body.cw-page .cw-contract-item .cw-badge {grid-column:1;grid-row:1;justify-self:start;min-width:0;max-width:100%;white-space:normal;}
body.cw-page .cw-contract-item > span:not(.cw-badge) {grid-column:1/-1;grid-row:2;min-width:0;overflow-wrap:break-word;}
body.cw-page .cw-contract-item small {grid-column:2;grid-row:1;align-self:center;}
/* Restrained administration density. No global font, button or header changes. */
body.orq-app-v2 main:has(> .orq-master-context),
body.orq-app-v2 main.cr-shell {gap:12px;}
body.orq-app-v2 .orq-master-context {padding:14px 18px;gap:14px;}
body.orq-app-v2 .orq-master-context__metric {padding:8px 12px;}
body.orq-app-v2 .orq-master-panel,
body.orq-app-v2 main.cr-shell .orq-card-content {padding:16px 20px;}
body.orq-app-v2 .orq-master-panel-head .orq-stack {gap:6px;}
body.orq-app-v2 .orq-master-panel-head :is(h2,p),
body.orq-app-v2 main.cr-shell .orq-card-content h2 {margin:0;}
body.orq-app-v2 main.cr-shell .orq-card-content h2 + p {margin:6px 0 0;}
body.orq-app-v2 .cr-map-head {row-gap:8px;}
body.orq-users-page .layout {gap:12px;margin-top:12px;}
body.orq-users-page .panel {padding:14px 18px;}
body.orq-users-page .toolbar {margin-bottom:8px;}
body.orq-users-page .toolbar .panel-sub {margin-bottom:6px;}
body.orq-users-page .user-list {gap:8px;}
body.orq-users-page .user-row {padding:8px 12px;}
body.orq-users-page .user-row > div:nth-child(3) {display:flex;flex-wrap:wrap;align-items:center;gap:5px;}
body.orq-users-page .user-row > div:nth-child(3) > div:empty {display:none;}

/* One click changes the palette; the icon shows the destination theme. */
html:root[data-orq-theme][data-orq-appearance] body .orq-appearance-toggle {position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;cursor:pointer;border:1px solid var(--orq-appearance-line);border-radius:50%;background:var(--orq-appearance-subtle);color:var(--orq-appearance-text);box-shadow:none;}
.orq-appearance-toggle svg {display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;}
.orq-appearance-toggle:focus-visible {outline:3px solid #60a5fa;outline-offset:3px;}
.orq-appearance-toggle:hover {filter:brightness(1.12);}
html[data-orq-theme="dark"] .orq-appearance-toggle .orq-appearance-moon,
html[data-orq-theme="light"] .orq-appearance-toggle .orq-appearance-sun {display:none;}
/* Reclaim section gutters, without changing maps, tables or type metrics. */
html body.orq-app-v2 {--orq-layout-page-padding:12px 16px 24px;--orq-layout-page-padding-dense:12px 16px 24px;--orq-layout-page-padding-mobile:10px;}
html body.orq-app-v2 .orq-layout-shell {gap:12px;}
html body .orq-global-hero-actions {gap:8px !important;column-gap:8px !important;}
body.orq-app-v2 .orq-master-context {padding:12px 16px;gap:12px;}
body.orq-app-v2 .orq-master-panel,
body.orq-app-v2 main.cr-shell .orq-card-content {padding:12px 16px;}
body.orq-app-v2 .orq-master-panel-head {margin-bottom:10px;}
@media(max-width:600px) {
  html body .orq-global-hero-actions {flex-wrap:wrap;}
}
@media print {.orq-appearance-toggle{display:none !important;}}

html body.orq-app-v2 > .orq-layout-shell {padding-top:10px !important;}
html body.orq-app-v2 .orq-layout-shell.orq-stack--lg {gap:12px;}
/* Keep branding legible when the hero gains an appearance control. */
@media(max-width:600px) {
  .orq-app-v2 .orq-app-header {position:relative;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:10px 12px;}
  .orq-app-v2 .orq-app-header__brand {grid-column:1/-1;grid-row:1;padding-right:56px;min-height:44px;}
  .orq-app-v2 .orq-app-header__brand .orq-brand-logo {width:140px;flex:0 0 140px;}
  html:root[data-orq-theme][data-orq-appearance] body.orq-app-v2 .orq-app-header__title {grid-column:1;grid-row:2;text-align:left;}
  html:root[data-orq-theme][data-orq-appearance] body.orq-app-v2 .orq-app-header__title h1 {font-size:20px !important;line-height:1.2 !important;}
  .orq-app-v2 .orq-app-header__actions {grid-column:2;grid-row:2;position:static;gap:6px;}
  html:root[data-orq-theme][data-orq-appearance] body.orq-app-v2 .orq-app-header__actions > .orq-appearance-toggle {position:absolute;right:12px;top:10px;}
}

/* Dialogs use paired surface/text roles in both palettes. Do not alter type,
   status meaning, permissions or the underlying form interactions. */
html:root[data-orq-theme][data-orq-appearance] body :is(
  .modal,.job-modal,.break-modal,.safe-modal,.job-detail-modal,.history-modal,.mywork-raise-modal,
  .modal-header,.modal-head,.job-modal-header,.diary-job-head,.raise-head,
  .modal-footer,.create-job-sticky-controls,.action-sticky-controls,.raise-actions,
  .create-requirements-shell,.raise-requirements,.modal-panel,.modal-panel-header,
  .action-summary-card,.action-note-entry,.action-duration-panel,.job-detail-section,.detail-notes,
  .cw-wizard,.cw-allocation,.orq-desktop-role-guidance-card) {
  background:var(--orq-appearance-panel) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .modal-field label,.raise-field label,.diary-job-field label,.create-requirement-row label,
  .modal-title,.create-modal-title,.action-panel-title,.action-summary-label,
  .create-requirements-title,.closest-title,.warning-title,.job-detail-title,
  .job-detail-section h3,.detail-item strong,.timeline-value,
  .orq-desktop-role-guidance h1) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .closest-empty,.create-pill-empty,.create-modal-sub,.raise-sub,.raise-empty,.diary-job-sub,
  .job-detail-sub,.detail-item,.timeline-label,.menu-eyebrow,
  .orq-desktop-role-guidance p) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .modal-close,.modal-close-btn,.report-close,.collapse-toggle-mini,.notes-toggle-btn,
  .system-tab:not(.active)) {
  background:var(--orq-appearance-subtle) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body .modal-open-ops-btn {background:#1d4ed8 !important;color:#fff !important;}
html:root[data-orq-theme][data-orq-appearance] body #removeTicketRelationshipMessage {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body :is(.value.ok,.posture-value.ok,.gate-state.Passed) {color:#166534 !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .gate-state:not(.Passed):not(.Failed) {color:#854d0e !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .gate-state.Failed {color:#b91c1c !important;}
html:root[data-orq-theme][data-orq-appearance] body .success :is(h2,.next,.identity strong) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body .success .identity small {color:var(--orq-appearance-muted) !important;}

/* Shared sub-panels and mobile dialog heads must inherit the same surface. */
html:root[data-orq-theme][data-orq-appearance] body :is(
  .action-summary-section,.action-sticky-stat,.confirm-modal,.confirm-head,.followup-panel,
  .mywork-site-diary-modal,.job-detail-head,.break-modal-head,.history-head,
  .history-toolbar,.history-card,.history-empty,.success .identity > div) {
  background:var(--orq-appearance-panel) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .history-title,.action-sticky-stat-value,.action-duration-title,.history-card-title) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .history-sub,.raise-helper,.modal-kicker,.contract-access-help,.action-sticky-stat-label,
  .action-duration-sub,.action-duration-field,.action-duration-status,.history-card-desc,
  .history-summary) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body .orq-desktop-role-guidance-kicker {color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme][data-orq-appearance] body .edit-tab {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body .edit-tab[aria-selected="true"] {color:var(--orq-appearance-link) !important;}
/* The hero message shortcut must not cover a dialog's Close control. */
html body.modal-open #orqMessageLauncher {visibility:hidden !important;pointer-events:none !important;}

html:root[data-orq-theme][data-orq-appearance] body :is(.action-summary-item strong,.confirm-title) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body .followup-help {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .confirm-kicker {color:#fdba74 !important;}
html:root[data-orq-theme][data-orq-appearance] body #menuDrawer .menu-item-arrow {color:var(--orq-appearance-text) !important;}

/* Account security and expanded ticket detail surfaces. */
html:root[data-orq-theme][data-orq-appearance] body :is(
  .action-summary-item,.mfa-dialog,.mfa-dialog-head,.mfa-stage,.password-zone) {
  background:var(--orq-appearance-panel) !important;
  color:var(--orq-appearance-text) !important;
  border-color:var(--orq-appearance-line) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(
  .card-copy,.profile-id,.mfa-dialog-head p,.mfa-stage p,.mfa-recovery-head p,
  .mfa-action-note) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.mfa-stage h4,.mfa-recovery-head h4) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body .password-zone-title {color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme][data-orq-appearance] body .mfa-steps span:not(.active):not(.complete) {
  background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-muted) !important;
}
/* These lifecycle warning cards retain their deliberately light status colours. */
html:root[data-orq-theme][data-orq-appearance] body .lifecycle-copy span {color:#475569 !important;}

html:root[data-orq-theme][data-orq-appearance] body :is(.action-alt-reference-current,.routine-description-value) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.action-alt-reference-current strong,.password-help) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .action-inline-status {color:#86efac !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .action-inline-status.warning {color:#fcd34d !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .action-inline-status.error {color:#fca5a5 !important;}

/* Keep security setup and administration tabs usable on narrow screens. */
@media(max-width:700px) {
  html body .mfa-verify {grid-template-columns:minmax(0,1fr);}
  html body .mfa-dialog .mfa-verify > * {min-width:0;}
  html body .edit-tabs {flex-wrap:wrap;}
  html body .edit-tab {white-space:normal;}
}

html:root[data-orq-theme][data-orq-appearance] body .orq-master-chip {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body .orq-master-status-active {color:#86efac !important;}

/* Gradient-backed panels need a paired surface too, especially in Light mode. */
html:root[data-orq-theme][data-orq-appearance] body :is(.report-modal,.report-modal-head,.report-scope,.hero,.planner-hero,.safe-note),
html:root[data-orq-theme][data-orq-appearance] body.orq-system-page :is(.section,.audit-row) {
  background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;
}
html:root[data-orq-theme][data-orq-appearance] body :is(.report-modal-title,.report-field label,.report-scope-copy strong,.audit-main) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.report-modal-sub,.report-help,.report-format,.report-scope-copy p,.report-scope-copy span,.audit-meta) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme][data-orq-appearance] body .report-kicker {color:var(--orq-appearance-link) !important;}
html:root[data-orq-theme][data-orq-appearance] body :is(.report-period,.collapse-btn,.entry .mark) {background:var(--orq-appearance-subtle) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
/* Darker blue endpoints retain the blue action treatment with readable white text. */
html:root[data-orq-theme][data-orq-appearance] body :is(
  #applyFiltersBtn,#downloadReportBtn,.report-scope-icon,.report-period.active,
  .btn.primary,.system-tab.active,button.submit,form:has(#confirmation) button[type="submit"]),
html:root[data-orq-theme][data-orq-appearance] body.orq-my-account-page .avatar {
  background:linear-gradient(110deg,#1d4ed8,#0369a1) !important;color:#fff !important;
}

html:root[data-orq-theme="light"][data-orq-appearance] body .hero .status {color:#854d0e !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .hero .status.Ready {color:#166534 !important;}
html:root[data-orq-theme="light"][data-orq-appearance] body .hero .status.Active {color:#1d4ed8 !important;}

/* Populated Sentinel views: surface and text colours travel together. */
html:root[data-orq-theme][data-orq-appearance] body.orq-security-page :is(.priority,.session,.incident-row,.audit-row,.detail,.fact,.empty,.privacy-note) {background:var(--orq-appearance-panel) !important;color:var(--orq-appearance-text) !important;border-color:var(--orq-appearance-line) !important;}
html:root[data-orq-theme][data-orq-appearance] body.orq-security-page :is(.row-title,.timeline-title,.fact-value,.trend-total,.review-box label) {color:var(--orq-appearance-text) !important;}
html:root[data-orq-theme][data-orq-appearance] body.orq-security-page :is(.row-meta,.timeline-meta,.fact-label,.review-history,.summary-label,.summary-sub,.brief-meta,.view-sub,.section-sub,.trend-label,.pager,.status.offline) {color:var(--orq-appearance-muted) !important;}
html:root[data-orq-theme="dark"][data-orq-appearance] body.orq-security-page .status.online {color:#86efac !important;}
html body.orq-security-page .summary {margin-top:10px;gap:10px;}
html body.orq-security-page :is(.brief,.tabs,.workspace) {margin-top:10px;}
html body.orq-security-page :is(.summary-card,.brief,.workspace,.section-card,.detail) {padding:12px 16px;}
html body.orq-security-page .view-head {margin-bottom:12px;}
html body.orq-security-page :is(.priority,.session,.incident-row,.audit-row) {padding:10px 12px;}
html body.orq-security-page .detail {min-height:0;}
html body.orq-security-page .detail-grid {margin:12px 0;}
/* Compact workspace entry without changing entry rules or customer identity. */
html body.orq-workspace-selection .page {width:min(1440px,calc(100% - 32px));padding:16px 0 24px;}
html body.orq-workspace-selection .topbar {margin-bottom:14px;}
html body.orq-workspace-selection .hero {min-height:0;padding:18px 22px;border-radius:20px;}
html body.orq-workspace-selection h1 {font-size:28px;line-height:1.2;}
html body.orq-workspace-selection .safe-note {margin-top:12px;padding:8px 12px;}
html body.orq-workspace-selection .section-head {margin:18px 0 12px;}
html body.orq-workspace-selection .grid {gap:14px;}
html body.orq-workspace-selection .card {min-height:0;padding:18px;border-radius:18px;}
html body.orq-workspace-selection .workspace-icon {width:40px;height:40px;border-radius:12px;}
html body.orq-workspace-selection .card h3 {margin-top:12px;}
html body.orq-workspace-selection .meta {margin-top:12px;}
html body.orq-workspace-selection :is(.card form,.card .future) {padding-top:16px;}
html body.orq-workspace-selection .card .enter-link {margin-top:16px;}
@media(max-width:700px) {html body.orq-workspace-selection .page {width:calc(100% - 20px);}html body.orq-workspace-selection .hero {padding:16px;}html body.orq-security-page :is(.workspace,.section-card,.detail) {padding:12px;}}

html:root[data-orq-theme][data-orq-appearance] body.orq-workspace-selection .enter {background:#2563eb !important;color:#fff !important;}
html:root[data-orq-theme][data-orq-appearance] body.orq-workspace-selection .meta span {color:var(--orq-appearance-muted);border-color:var(--orq-appearance-line);}
html:root[data-orq-theme="light"][data-orq-appearance] body.orq-workspace-selection .workspace-icon {color:#1d4ed8;}
html:root[data-orq-theme="light"][data-orq-appearance] body.orq-workspace-selection .status {color:#047857;}
