/* Appearance controls are shared; dark overrides never alter document printing or ink. */
.ow-appearance { margin-bottom:18px; }
.ow-appearance h3 { margin:0 0 5px; font-size:16px; }
.ow-appearance p { margin:0; color:var(--m); font-size:12px; }
.ow-appearance-options { display:flex; flex-wrap:wrap; gap:12px; padding:0; border:0; margin:17px 0 13px; }
.ow-appearance-options label { position:relative; display:flex; align-items:center; gap:12px; width:260px; max-width:100%; padding:14px; border:1px solid var(--l); border-radius:10px; cursor:pointer; }
.ow-appearance-options label:has(input:checked) { border-color:var(--o); box-shadow:0 0 0 1px var(--o); background:#478b3c08; }
.ow-appearance-options label:has(input:focus-visible) { outline:2px solid var(--o); outline-offset:4px; }
.ow-appearance-options input { position:absolute; top:14px; right:12px; width:15px; height:15px; margin:0; accent-color:var(--o); }
.ow-appearance-options strong { display:block; font-size:13px; padding-right:12px; }
.ow-appearance-options small { display:block; margin-top:4px; color:var(--m); font-size:10px; }
.ow-appearance-preview { display:grid; grid-template-columns:15px 1fr 1fr; gap:4px; width:67px; height:46px; padding:6px; border:1px solid #cfd8e2; border-radius:6px; flex-shrink:0; background:#f4f6fa; }
.ow-appearance-preview i { grid-row:span 2; background:#1b3250; border-radius:2px; }
.ow-appearance-preview b { align-self:end; height:21px; border-radius:2px; background:#fff; border:1px solid #dbe2e9; }
.ow-preview-dark { background:#0f1722; border-color:#3d4d61; }
.ow-preview-dark b { background:#263347; border-color:#415167; }
.ow-appearance-sr { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
@media screen {
  html[data-ow-theme="dark"] {
    color-scheme:dark;
    --bg:#101721; --p:#192431; --p2:#233140; --panel:#192431;
    --t:#e5ecf4; --m:#a5b4c5; --muted:#a5b4c5; --l:#354457;
    --o:#92ca84; --g:#88d4ac; --a:#efc57c; --r:#f29ba4; --ow-green:#92ca84;
    --ow-surface:#192431; --ow-raised:#223041; --ow-input:#121c28;
  }
  html[data-ow-theme="dark"] body { background:var(--bg); color:var(--t); }
  html[data-ow-theme="dark"] :is(.main,.section,.dialog-body) { color:var(--t); }
  html[data-ow-theme="dark"] :is(.card,.panel,.health-card,.dialog,.modal-card,.panel-head,.dialog-head,.dialog-foot,.global-results,.v110-alert,.mobile-job,.v15-form-card,.ow-dash-stat,.ow-dash-panel,.ow-geo-card,.ow-cal-controls,.ow-cal-switch,.ow-form-card,.ow-form-search,.ow-date-popover,.ow-appearance-options label) {
    background:var(--ow-surface); color:var(--t); border-color:var(--l); box-shadow:none;
  }
  html[data-ow-theme="dark"] :is(.site-box,.detail,.month,.sla-preview,.notice,.ow-form-context,.ow-geo-aside,.ow-geo-map-wrap,.ow-geo-legend,.ow-week-heading,.ow-form-steps button>span) { background:var(--ow-raised); border-color:var(--l); color:var(--t); }
  html[data-ow-theme="dark"] :is(.topbar h2,.panel-head h3,.dialog-head h2,.dialog-head h3,.ow-workspace-name b,.card strong,.ow-dash-heading h2,.ow-dash-stat>strong,.ow-dash-panel-head h3,.ow-dash-row,.ow-dash-row>strong,.ow-dash-rate>div,.ow-geo-heading h3,.ow-geo-ranking-head h4,.ow-geo-ranking-row,.ow-geo-detail-totals b,.ow-geo-record,.ow-geo-unmapped-row b,.ow-form-list-head h3,.ow-form-name,.ow-form-stat strong,.ow-form-context b,.ow-week-heading b,.cal-num,#calendarTitle,#owGeoDetails h4,#owFormStepTitle) { color:var(--t); }
  html[data-ow-theme="dark"] :is(.muted,.sub,.form-group label,.topbar p,.ow-workspace-name,.ow-dash-heading p,.ow-dash-stat>span,.ow-dash-stat>small,.ow-dash-today small,.ow-dash-row>span>small,.ow-dash-renewals>small,.ow-dash-renewals>button>span,.ow-dash-renewals p,.ow-dash-rate small,.ow-dash-rate strong.ow-dash-no-data,.ow-dash-status,.ow-dash-queue-item small,.ow-geo-heading p,.ow-geo-eyebrow,.ow-geo-controls label,.ow-geo-ranking-row small,.ow-geo-bottom,.ow-geo-legend,.ow-geo-record span,.ow-geo-site>b,.ow-geo-site>small,.ow-geo-unmapped-row small,.ow-geo-detail-totals,.ow-form-stage,.ow-form-stat,.ow-form-context small,.ow-form-steps button,.ow-form-print,.ow-signature-hint,.ow-signature-status,.ow-cal-totals,.ow-form-empty,#owGeoDetails>p,#owGeoDetails h5,#owGeoUnmappedRows>p,#owDashQueueNote,#owFormCount,#owFormStepHelp,#owFormStepPosition,#owFormReference) { color:var(--m); }
  html[data-ow-theme="dark"] :is(.field,.form-group input,.form-group select,.form-group textarea,.ow-geo-controls select,.ow-date-trigger,.ow-date-head select) { background:var(--ow-input); border-color:var(--l); color:var(--t); }
  html[data-ow-theme="dark"] #documentsForms .ow-form-search { background:var(--ow-input); color:var(--m); }
  html[data-ow-theme="dark"] .ow-form-search input { background:transparent; color:var(--t); }
  html[data-ow-theme="dark"] :is(input,textarea)::placeholder { color:#90a2b6; opacity:1; }
  html[data-ow-theme="dark"] :is(input,textarea,select):focus-visible { outline-color:var(--o); }
  html[data-ow-theme="dark"] :is(.btn,.ow-sidebar-toggle,.ow-cal-today,.ow-cal-arrow,.ow-date-head>button,.ow-form-categories button,.ow-geo-map-toolbar button,.ow-geo-bottom button,.ow-geo-ranking-head button,.ow-geo-directions a,.ow-dash-queue-item,.ow-day-job) { background:var(--ow-raised); border-color:var(--l); color:var(--t); }
  html[data-ow-theme="dark"] :is(.btn,.ow-form-card,.ow-form-categories button,.ow-dash-queue-item,.ow-day-job):hover { background:#2a3b4b; border-color:#71967a; }
  html[data-ow-theme="dark"] .btn.primary { background:#477f3d; border-color:#609a55; color:#fff; }
  html[data-ow-theme="dark"] .btn.primary:hover { background:#528d47; }
  html[data-ow-theme="dark"] .btn.danger { color:#f29ba4; }
  html[data-ow-theme="dark"] .btn.danger:hover { background:#402b38; }
  html[data-ow-theme="dark"] :is(.ow-dash-panel-head>button,.ow-dash-today>button,.ow-dash-status button,.ow-dash-renewals>button>b,.ow-dash-queue-item>span:last-child,.ow-geo-back,.ow-geo-site>button,.ow-geo-unmapped-row button,.ow-form-context button,.ow-date-foot button,.ow-calendar-more,.profile-link,.ow-form-card:hover .ow-form-name,#owFormSaveStatus,.ow-signature-status.is-signed) { color:var(--o); }
  html[data-ow-theme="dark"] :is(.table th,.cal-head,.ow-cal-view-month .cal-head) { background:var(--ow-raised); color:var(--m); border-color:var(--l); }
  html[data-ow-theme="dark"] :is(.table td,.list-item,.contract-list-item,.doc-item,.audit-item,.system-row,.global-result,.ow-dash-panel-head,.ow-dash-today,.ow-dash-row,.ow-dash-rate,.ow-form-list-head,.ow-form-steps,.ow-date-foot,.ow-cal-totals,.ow-week-day,.ow-day-agenda-head,.ow-geo-ranking-row,.ow-geo-ranking-head>div,.ow-geo-site,.ow-geo-record,.ow-geo-detail-totals,.ow-geo-unmapped-row,#owGeoUnmapped) { border-color:var(--l); }
  html[data-ow-theme="dark"] :is(.clickable-row:hover td,.global-result:hover) { background:var(--ow-raised); }
  html[data-ow-theme="dark"] :is(.pill,.tag,.contact-count,.takeover-step,.booking-pill,.badge.silver,.badge.platinum,.job-status.planned,.job-status.due,.callout-status.cancelled,.reminder-escalation.neutral,.v110-pill) { background:#293a4e; border-color:#43566e; color:#c7d6e9; }
  html[data-ow-theme="dark"] :is(.badge.active,.job-status.completed,.job-status.paid,.callout-status.resolved,.callout-kpi.met,.reminder-escalation.green,.v110-pill.green) { background:#203e34; color:#9cdbb9; border-color:#436857; }
  html[data-ow-theme="dark"] :is(.badge.pending,.badge.gold,.job-status.rebooked,.job-status.revisit,.callout-status.attended,.callout-kpi.waiting,.reminder-escalation.amber,.v110-pill.amber,.contact-count.hot,.uplift-box,.v100-entitlement) { background:#3c3525; color:#efcf91; border-color:#716044; }
  html[data-ow-theme="dark"] :is(.badge.expired,.badge.lost,.job-status.cancelled,.job-status.overdue,.callout-status.open,.callout-kpi.missed,.reminder-escalation.red,.v110-pill.red) { background:#432c37; color:#f6abb6; border-color:#764757; }
  html[data-ow-theme="dark"] :is(.job-status.billed,.cal-job.saved-form,.ow-agenda-job.saved-form) { background:#32344c; color:#c3c8f1; border-color:#7d88bd; }
  html[data-ow-theme="dark"] :is(.status-open,.profit-neg,.ow-dash-row>strong.ow-dash-alert) { color:#f29ba4; }
  html[data-ow-theme="dark"] :is(.status-good,.profit-pos) { color:#9cdbb9; }
  html[data-ow-theme="dark"] :is(.status-warn,.ow-dash-backup-needed,#owGeoUnmapped summary) { color:#efcf91; }
  html[data-ow-theme="dark"] :is(.cal-day,.cal-day.ow-weekend,.ow-cal-view-month .cal-day,.ow-week-day) { background:var(--ow-surface); border-color:var(--l); }
  html[data-ow-theme="dark"] :is(.cal-day.outside,.ow-cal-view-month .cal-day.outside) { background:#141e2a; }
  html[data-ow-theme="dark"] :is(.ow-cal-view-month .cal-day.ow-today,.ow-week-today) { background:#23392d; }
  html[data-ow-theme="dark"] :is(.ow-today .cal-num,.ow-cal-view-month .ow-today .cal-num,.ow-cal-add) { color:var(--o); }
  html[data-ow-theme="dark"] :is(.cal-job,.ow-agenda-job) { background:#243d31; color:#c0e1b7; border-color:#79a66a; }
  html[data-ow-theme="dark"] :is(.cal-job.fault,.ow-agenda-job.fault) { background:#402b36; color:#f5b4c0; border-color:#bd788e; }
  html[data-ow-theme="dark"] :is(.cal-job.remedial,.ow-agenda-job.remedial) { background:#263a50; color:#b8d7f5; border-color:#7fa6cf; }
  html[data-ow-theme="dark"] .cal-job small { color:inherit; }
  html[data-ow-theme="dark"] .ow-cal-switch button { color:var(--m); }
  html[data-ow-theme="dark"] .ow-cal-switch button.active { background:#477f3d; color:#fff; }
  html[data-ow-theme="dark"] :is(.ow-form-categories button[aria-pressed="true"],.ow-geo-ranking-head button[aria-pressed="true"],.ow-form-steps button[aria-selected="true"]>span,.month.selected) { background:#2b4433; color:#b7e0a9; border-color:#79a66a; }
  html[data-ow-theme="dark"] .ow-form-steps button[aria-selected="true"] { color:#b7e0a9; border-bottom-color:#92ca84; }
  html[data-ow-theme="dark"] .ow-form-steps button:hover { color:var(--o); }
  html[data-ow-theme="dark"] #v15FormModal.ow-guided-form :is(.dialog-body,.dialog-foot) { background:var(--ow-surface); border-color:var(--l); }
  html[data-ow-theme="dark"] #v15FormModal.ow-guided-form .form-group label { color:var(--m); }
  html[data-ow-theme="dark"] #owFormSignoffPanel .ow-signature-card { background:var(--ow-raised); border-color:var(--l); }
  html[data-ow-theme="dark"] #owFormSignoffPanel .ow-signature-card>label { color:var(--t) !important; }
  html[data-ow-theme="dark"] #owFormSignoffPanel .ow-signature-card>button { color:var(--m); }
  /* Keep drawing surfaces and document previews white: ink is exported unchanged. */
  html[data-ow-theme="dark"] :is(.mini-sig,.esign-pad,.contract-preview) { color-scheme:light; background:#fff; color:#111; }
  html[data-ow-theme="dark"] :is(.ow-date-head>button,.ow-date-head select,.ow-date-grid button) { color:var(--t); }
  html[data-ow-theme="dark"] .ow-date-grid button.outside { color:#7e8da1; }
  html[data-ow-theme="dark"] .ow-date-grid button:hover { background:#2b4433; }
  html[data-ow-theme="dark"] .ow-date-grid button.selected { background:#477f3d; color:#fff; }
  html[data-ow-theme="dark"] :is(.ow-geo-card:fullscreen,.ow-geo-map-toolbar) { background:var(--ow-surface); color:var(--m); }
  html[data-ow-theme="dark"] .ow-geo-map { background:#233140; }
  /* Do not invert street tiles or their colours. */
  html[data-ow-theme="dark"] .ow-geo-map :is(.leaflet-control-zoom a,.leaflet-control-attribution,.leaflet-tooltip) { background:#192431; color:#d5e0ed; border-color:#435469; }
  html[data-ow-theme="dark"] .ow-geo-map .leaflet-control-attribution a { color:#b5dca9; }
  html[data-ow-theme="dark"] .mobile-bottom-nav { background:#192431f5; border-color:var(--l); }
  html[data-ow-theme="dark"] .mobile-bottom-nav button { color:var(--m); }
  html[data-ow-theme="dark"] .mobile-bottom-nav button.active { background:#2b4433; color:#b7e0a9; }
  html[data-ow-theme="dark"] .v13-install-tip { background:var(--ow-raised); color:var(--t); border-color:var(--l); }
  html[data-ow-theme="dark"] .table.v13-card-table tr { background:var(--ow-surface); border-color:var(--l); }
  html[data-ow-theme="dark"] ::selection { background:#4a6b4f; color:#fff; }
  html[data-ow-theme="dark"] .ow-appearance-options label:has(input:checked) { border-color:var(--o); background:#26392f; box-shadow:0 0 0 1px var(--o); }
}
