/* Tenant-owned application palettes. Paper reports and print retain their CI. */
@media screen {
  body[data-ui-theme]:not(.document-body) {
    --bg: #f2f5f8;
    --paper: #ffffff;
    --ink: #233040;
    --muted: #606d7d;
    --line: #dce3eb;
    --brand: #19344f;
    --brand-soft: #e5edf5;
    --accent: #345d83;
    --ui-nav: #f5f7fa;
    --ui-on-brand: #ffffff;
    --ui-error: #a12828;
    --ui-warning-bg: #fff3db;
    --ui-warning-ink: #74420e;
    --shadow: 0 8px 24px rgba(25, 52, 79, .05);
    color-scheme: light;
    background: var(--bg);
  }
  body[data-ui-theme="dark"]:not(.document-body) {
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23b2c0d1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --bg: #111c2a;
    --paper: #1b2a3c;
    --ink: #eef3fa;
    --muted: #b2c0d1;
    --line: #3e526b;
    --brand: #a3c2df;
    --brand-soft: #2b435c;
    --accent: #b7d0e8;
    --ui-nav: #172436;
    --ui-on-brand: #102538;
    --ui-error: #ffb4ad;
    --ui-warning-bg: #423422;
    --ui-warning-ink: #ffdaa1;
    --shadow: 0 8px 24px rgba(0, 0, 0, .1);
    color-scheme: dark;
  }
  body[data-ui-theme]:not(.document-body) a { color: var(--brand); }
  body[data-ui-theme]:not(.document-body) :is(.button:not(.button-secondary):not(.button-light), .status-panel, .range-pill, .report-tab-active, .workflow-stage[aria-current="step"] .workflow-stage-number, .location-score-grade) {
    background: var(--brand); color: var(--ui-on-brand); border-color: var(--brand);
  }
  body[data-ui-theme]:not(.document-body) .button-secondary { color: var(--brand); }
  body[data-ui-theme]:not(.document-body) .button-light { background: var(--brand-soft); color: var(--brand); }
  body[data-ui-theme]:not(.document-body) :is(.form-section-layout, .form-section-link[aria-current="page"], .sidebar-account-panel, .workflow-more-menu, .draft-notice, .report-tabs, .workflow-item, .help-link-card, .help-formula-item, .audit-item, .audit-step, .inline-checkbox-group, .inline-summary-card, .land-value-lookup-table, .land-value-best-match, .adjustment-card, .unit-card, .report-row:not(.report-head), .rnd-group, .range-scale span, .ticket-metrics > span) {
    background: var(--paper); border-color: var(--line);
  }
  body[data-ui-theme]:not(.document-body) :is(.form-section-sidebar, .workflow-stage-number, .report-tab-disabled) { background: var(--ui-nav); }
  body[data-ui-theme]:not(.document-body) :is(.section-note, .range-card, .nhk-display, .formset-row, .land-value-lookup-card, .land-value-lookup-head, .audit-item-total, .workflow-item-current, .location-score-badge, .location-score-item, .contract-ready, .range-scale .is-active) {
    background: var(--brand-soft); border-color: var(--line);
  }
  body[data-ui-theme]:not(.document-body) :is(.sidebar-link:hover, .sidebar-group > summary:hover, .sidebar-account > summary:hover, .sidebar-submenu a:hover, .sidebar-account-panel a:hover, .sidebar-account-panel button:hover, .workflow-stage:hover:not(:disabled), .report-tab:hover) {
    background: var(--brand-soft);
  }
  body[data-ui-theme]:not(.document-body) .report-tab-active:hover { background: var(--brand); color: var(--ui-on-brand); }
  body[data-ui-theme]:not(.document-body) :is(.form-control, .form-select, .form-textarea, .form-section-picker select, .portal-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .portal-form select, .portal-form textarea) {
    background-color: var(--paper); color: var(--ink); border-color: var(--line);
  }
  body[data-ui-theme]:not(.document-body) :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
  body[data-ui-theme]:not(.document-body) :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--brand); }
  body[data-ui-theme]:not(.document-body) :is(.muted, .portal-form .helptext, .marketing-option small, .ticket-table small) { color: var(--muted); }
  body[data-ui-theme]:not(.document-body) :is(.field-errors, .error-box, .portal-form .errorlist, .form-section-error, .form-carousel-status, .carousel-error) { color: var(--ui-error); }
  body[data-ui-theme]:not(.document-body) :is(.ticket-metrics strong, .ticket-table th, .ticket-change) { color: var(--brand); }
  body[data-ui-theme]:not(.document-body) :is(.ticket-table th, .ticket-table td, .ticket-reply, .customer-marketing, .portal-form #id_strategy label) { border-color: var(--line); }
  body[data-ui-theme]:not(.document-body) .marketing-option { background: var(--paper); color: var(--ink); border-color: var(--line); }
  body[data-ui-theme]:not(.document-body) :is(.marketing-option:hover, .marketing-option.is-selected, .portal-form #id_strategy label:has(input:checked)) { background: var(--brand-soft); border-color: var(--brand); }
  body[data-ui-theme]:not(.document-body) .document-map-notice { background: var(--ui-warning-bg); color: var(--ui-warning-ink); }
  body[data-ui-theme]:not(.document-body) .check-dialog { color: var(--ink); }
  body[data-ui-theme]:not(.document-body) .company-brand-preview { color-scheme: light; color: #233040; }
}
.interface-theme-settings { margin: 24px 0; }
.interface-theme-settings h3 { margin-top: 0; }
.interface-theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.interface-theme-option { display: grid; gap: 8px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.interface-theme-option > span:not(.interface-theme-swatch) { font-weight: 600; }
.interface-theme-option small { color: var(--muted); }
.interface-theme-option[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.interface-theme-option:hover { background: var(--brand-soft); }
.interface-theme-option:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.interface-theme-swatch { display: flex; gap: 6px; width: fit-content; padding: 8px; border-radius: 6px; }
.interface-theme-swatch > span { display: block; width: 28px; height: 20px; border-radius: 3px; }
.interface-theme-swatch-light { background: #f2f5f8; }
.interface-theme-swatch-light > span:nth-child(1) { background: #ffffff; }
.interface-theme-swatch-light > span:nth-child(2) { background: #19344f; }
.interface-theme-swatch-light > span:nth-child(3) { background: #e5edf5; }
.interface-theme-swatch-dark { background: #111c2a; }
.interface-theme-swatch-dark > span:nth-child(1) { background: #1b2a3c; }
.interface-theme-swatch-dark > span:nth-child(2) { background: #a3c2df; }
.interface-theme-swatch-dark > span:nth-child(3) { background: #2b435c; }
@media(max-width: 600px) { .interface-theme-options { grid-template-columns: minmax(0, 1fr); } }
