/* OPTICAL is a product design, independent of the saved chromatic UI palette.
   Only presentation is changed. State labels, visibility and data stay owned
   by the existing controllers. STANDARD never enters this scope. */
html[data-design-theme="optical"] {
  color-scheme: dark;
  --op-ground: #171f23;
  --op-deep: #131d22;
  --op-surface: #202b30;
  --op-raised: #29363c;
  --op-hover: #33444a;
  --op-ink: #e3e7df;
  --op-muted: #b0c0c0;
  --op-faint: #91a9ad;
  --op-line: #566b71;
  --op-control-line: #82989c;
  --op-line-soft: #3d5158;
  --op-paper: #d8dfd6;
  --op-paper-ink: #1f2c31;
  --op-link: #bdcfc9;
  --op-focus: #f0dec0;
  --op-ai: #a6bfcd;
  --op-ai-fill: #7998ad;
  --op-human: #b5d0bf;
  --op-human-fill: #88b2a2;
  --op-warning: #e1c49a;
  --op-warning-surface: #382f25;
  --op-warning-line: #947b54;
  --op-error: #edb6ab;
  --op-error-surface: #3b2b2a;
  --op-error-line: #956e65;
  --op-success-surface: #293e37;
  --op-success-line: #668e7a;
  --op-focus-font: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, serif;
  --accent: var(--op-paper);
  --muted: var(--op-muted);
  --line: var(--op-line-soft);
  --soft: var(--op-raised);
  --surface: var(--op-raised);
  --presence-ink: var(--op-ink);
  --presence-muted: var(--op-muted);
  --presence-paper: var(--op-ground);
  color: var(--op-ink);
  background: var(--op-ground);
}

html[data-design-theme="optical"] body {
  color: var(--op-ink);
  background: radial-gradient(ellipse at 75% 0, #26343a 0, var(--op-ground) 60%);
}

html[data-design-theme="optical"] :is(button, input, textarea, select) {
  accent-color: var(--op-human-fill);
}
html[data-design-theme="optical"] :is(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--op-focus);
  outline-offset: 4px;
}
html[data-design-theme="optical"] :is(input, textarea)::placeholder {
  color: var(--op-faint);
  opacity: 1;
}
html[data-design-theme="optical"] :is(.button, .small-button, .icon-button, .comparison-close, .company-editor-close, .portrait-lighting-close, .background-close) {
  box-shadow: none;
  border-radius: 6px;
  font-weight: 400;
}
html[data-design-theme="optical"] :is(.button.secondary, .small-button, .comparison-close, .company-editor-close, .portrait-lighting-close, .background-close) {
  color: var(--op-ink);
  background: var(--op-surface);
  border-color: var(--op-line);
}
html[data-design-theme="optical"] :is(.button.secondary, .small-button, .comparison-close, .company-editor-close, .portrait-lighting-close, .background-close):hover:enabled {
  color: var(--op-ink);
  background: var(--op-hover);
  border-color: var(--op-faint);
  box-shadow: none;
  transform: none;
}
html[data-design-theme="optical"] .button.primary {
  color: var(--op-paper-ink);
  background: var(--op-paper);
  border-color: var(--op-paper);
  box-shadow: none;
}
html[data-design-theme="optical"] .button.primary:hover:enabled {
  color: var(--op-paper-ink);
  background: #ebeee6;
  border-color: #ebeee6;
}
html[data-design-theme="optical"] .text-button {
  color: var(--op-link);
  text-underline-offset: 4px;
}
html[data-design-theme="optical"] .text-button:hover:enabled { color: var(--op-ink); }
html[data-design-theme="optical"] .icon-button { color: var(--op-muted); }
html[data-design-theme="optical"] .icon-button:hover:enabled {
  color: var(--op-ink);
  background: var(--op-raised);
}
html[data-design-theme="optical"] button:disabled { opacity: .48; }
html[data-design-theme="optical"] :is(.eyebrow, .small-label) { color: var(--op-faint); }

/* Form surfaces stay opaque enough to read over the surrounding material. */
html[data-design-theme="optical"] :is(.field, .review-tool-field, .human-score-field, .dm-field, .oc-field, .pr-field) {
  color: var(--op-muted);
}
html[data-design-theme="optical"] :is(.field, .review-tool-field, .human-score-field, .dm-field, .oc-field, .pr-field) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), textarea, select),
html[data-design-theme="optical"] .operator-policy :is(input, select, textarea) {
  color: var(--op-ink);
  background: var(--op-deep);
  border-color: var(--op-control-line);
  border-radius: 5px;
  box-shadow: none;
}
html[data-design-theme="optical"] :is(.field, .review-tool-field, .human-score-field, .dm-field, .oc-field, .pr-field) :is(input, textarea, select):hover:enabled {
  border-color: var(--op-faint);
}
html[data-design-theme="optical"] :is(.field, .review-tool-field, .human-score-field) select option {
  color: var(--op-ink);
  background: var(--op-deep);
}

/* Shared modal material; no sizing, stacking or open/closed rules are changed. */
html[data-design-theme="optical"] dialog {
  --sp-panel-ink: var(--op-ink);
  --sp-panel-muted: var(--op-muted);
  --sp-panel-faint: var(--op-faint);
  --sp-panel-line: var(--op-line-soft);
  --sp-panel-paper: var(--op-surface);
  --sp-panel-soft: var(--op-deep);
  --sp-panel-accent: var(--op-human);
  --sp-panel-ai: var(--op-ai-fill);
  --sp-panel-human: var(--op-human-fill);
  --sp-panel-warning: var(--op-warning);
  --sp-panel-error: var(--op-error);
  color: var(--op-ink);
  background: var(--op-surface);
  border: 1px solid var(--op-line);
  border-radius: 12px;
  box-shadow: 0 30px 100px #02090c66;
}
html[data-design-theme="optical"] dialog::backdrop {
  background: #071115b8;
  backdrop-filter: blur(6px);
}
html[data-design-theme="optical"] dialog :is(.dialog-heading h2, .help-steps strong) {
  color: var(--op-ink);
  font-weight: 400;
}
html[data-design-theme="optical"] dialog :is(.dialog-description, .settings-note, .template-settings-note, .review-tool-note, .api-info, .help-steps p, .help-steps li, .mode-options small) {
  color: var(--op-muted);
}
html[data-design-theme="optical"] dialog :is(.field input:not([type=radio]):not([type=checkbox]):not([type=color]):not([type=range]), .field select, .field textarea, .human-score-field select, .microphone-device-choice select, .microphone-settings select) {
  color: var(--op-ink);
  background: var(--op-deep);
  border-color: var(--op-control-line);
}
html[data-design-theme="optical"] dialog :is(.mode-options>label, .api-info, .portrait-shortcut, .template-preview, .company-editor-card, .company-editor-mappings, .template-criterion, .criterion-anchors, .upload-area) {
  color: var(--op-muted);
  background: var(--op-raised);
  border-color: var(--op-line-soft);
  border-radius: 7px;
}
html[data-design-theme="optical"] dialog :is(.template-preview-title, .template-criterion>strong, .company-editor-card-heading h3, .portrait-shortcut>strong) { color: var(--op-ink); }
html[data-design-theme="optical"] dialog :is(.template-description, .template-interview-plan, .template-review-note, .template-question-preview, .template-question-preview ul, .template-anchors, .template-preflight-reference, .portrait-shortcut>p) { color: var(--op-muted); }
html[data-design-theme="optical"] dialog .template-version { color: var(--op-human); background: var(--op-success-surface); }
html[data-design-theme="optical"] :is(.company-editor-panel, .company-editor-footer, .company-editor-tabs) { border-color: var(--op-line-soft); }
html[data-design-theme="optical"] .company-editor-footer { background: var(--op-deep); }
html[data-design-theme="optical"] :is(.company-editor-tab, .company-editor-provenance, .company-editor-note, .company-editor-mappings legend, .company-editor-mappings label, .company-editor-guidance, .company-editor-anchors, .company-editor-weight) { color: var(--op-muted); }
html[data-design-theme="optical"] .company-editor-tab[aria-selected=true] { color: var(--op-ink); border-color: var(--op-human); }

/* Basic feedback retains existing words and state classes. */
html[data-design-theme="optical"] :is(.review-empty, .review-empty svg, .review-empty h3, .record-list-empty, .comparison-empty, .dm-empty, .oc-empty, .pr-empty) { color: var(--op-muted); }
html[data-design-theme="optical"] :is(.video-empty, .review-quality-empty, .face-observation-empty, .dm-empty, .oc-empty, .pr-empty) {
  background: var(--op-deep);
  border-color: var(--op-line);
}
html[data-design-theme="optical"] :is(.access-error, .interface-theme-error, .company-editor-error, .operator-policy-error, .dm-error, .oc-error, .pr-error, .result-report-error) { color: var(--op-error); }
html[data-design-theme="optical"] :is(.company-editor-error, .dm-error, .oc-error, .pr-error) { background: var(--op-error-surface); border-color: var(--op-error-line); }
html[data-design-theme="optical"] :is(.company-editor-discard, .oc-discard, .oc-notice, .pr-guard, .pr-notice, .remote-entry-notice, .remote-entry-notice.is-warning) {
  color: var(--op-warning);
  background: var(--op-warning-surface);
  border-color: var(--op-warning-line);
}
html[data-design-theme="optical"] :is(.danger-text, .company-editor-discard-button, .dm-button.is-danger-quiet) { color: var(--op-error); border-color: var(--op-error-line); }
html[data-design-theme="optical"] .avatar-loading { color: var(--op-muted); background: #182328e0; }
html[data-design-theme="optical"] .loader { border-color: var(--op-line); border-top-color: var(--op-paper); }

/* Advanced existing tools share chrome, while real appearance swatches and
   preview images keep their authored colors. */
html[data-design-theme="optical"] :is(.dm-card, .dm-directory, .dm-job, .dm-backup-row, .dm-record-row, .dm-recovery, .dm-dialog-target, .oc-header, .oc-latest, .oc-preview, .oc-metrics>div, .oc-conversation, .pr-heading, .pr-selection, .pr-list-item, .pr-detail, .pr-readiness-row, .operator-policy-summary, .operator-policy-diagnostic-preview) {
  color: var(--op-ink);
  background: var(--op-raised);
  border-color: var(--op-line-soft);
}
html[data-design-theme="optical"] :is(.dm-button, .oc-button, .pr-button, .operator-policy-steps button, .portrait-lighting-preset, .background-filter, .background-choice, .interface-theme-choice) {
  color: var(--op-ink);
  background: var(--op-surface);
  border-color: var(--op-line);
  box-shadow: none;
}
html[data-design-theme="optical"] :is(.dm-button, .oc-button, .pr-button, .portrait-lighting-preset, .background-filter, .background-choice, .interface-theme-choice):hover:enabled {
  color: var(--op-ink);
  background: var(--op-hover);
  border-color: var(--op-faint);
}
html[data-design-theme="optical"] :is(.portrait-lighting-preset, .background-filter, .background-choice, .interface-theme-choice)[aria-pressed=true],
html[data-design-theme="optical"] .oc-tabs [aria-selected=true],
html[data-design-theme="optical"] .pr-list-item.is-current {
  color: var(--op-ink);
  background: var(--op-hover);
  border-color: var(--op-human);
}
html[data-design-theme="optical"] :is(.dm-button.is-primary, .oc-button.is-primary, .pr-button.is-primary, .interface-theme-actions .interface-theme-save) {
  color: var(--op-paper-ink);
  background: var(--op-paper);
  border-color: var(--op-paper);
}
html[data-design-theme="optical"] :is(.dm-button.is-primary, .oc-button.is-primary, .pr-button.is-primary, .interface-theme-actions .interface-theme-save):hover:enabled {
  color: var(--op-paper-ink);
  background: #ebeee6;
}
html[data-design-theme="optical"] .dm-button.is-danger { color: var(--op-error); background: var(--op-error-surface); border-color: var(--op-error-line); }
html[data-design-theme="optical"] :is(.operator-setup-status, .oc-report-state, .pr-list-state, .pr-check-state) { color: var(--op-muted); background: var(--op-raised); border-color: var(--op-line); }
html[data-design-theme="optical"] .operator-setup-status.needs-setup { color: var(--op-warning); background: var(--op-warning-surface); border-color: var(--op-warning-line); }

@media (prefers-reduced-transparency: reduce) {
  html[data-design-theme="optical"] dialog::backdrop { backdrop-filter: none; background: #071115e8; }
}
