/* Shared appearance layer. Screen-only overrides keep documents and printing light. */
:root { color-scheme: light; }
.theme-toggle {
  flex: 0 0 auto; align-self: center; min-height: 38px; padding: 8px 12px;
  margin: 8px 12px; border: 1px solid #849cb1; border-radius: 6px;
  background: #203f5d; color: #fff; font: 600 12px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.theme-toggle:hover { background: #315778; }
.theme-toggle-floating { position: fixed; right: 16px; bottom: 80px; z-index: 99; }
:focus-visible { outline: 3px solid #a66b00; outline-offset: 3px; }
/* Readability repairs also apply to the existing light theme. */
footer p[style*="opacity"] { opacity: 1 !important; }
th .en { color: #d7e6f3; }
.product-ov-card .ov-link, .process-step span, .flow-step .num, .search-result-meta { color: #85600e; }
.qe-card .btn, .back-top, .primary-action { background: #906514; }
.catalog-category-button :is(.index, small), .catalog-series-head span, .catalog-upload-date,
.catalog-series-directory span, .admin-brand span, .admin-sidebar-title { color: #536675; }
.catalog-product-index, .panel-kicker, .viewer-category { color: #96501d; }
.catalog-tab.is-active small { color: #fff; }
.admin-shell { --muted: #536675; }
.primary-button, .viewer-download { background: #126b69; }
.catalog-mobile-picker { grid-template-columns: minmax(0, 1fr); }
.catalog-mobile-picker select { min-width: 0; width: 100%; }
.hero-info .hi-label { opacity: .85; }
@media (min-width: 901px) {
  nav .nav-inner:has(.mobile-nav-toggle) { max-width: 1440px; }
  nav .nav-inner:has(.mobile-nav-toggle) a { padding-left: 12px; padding-right: 12px; }
  nav .nav-inner:has(.mobile-nav-toggle) .theme-toggle { margin-left: auto; margin-right: 12px; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  nav .nav-inner:has(.mobile-nav-toggle) > a .nav-en,
  nav .nav-inner:has(.mobile-nav-toggle) > .dropdown > a .nav-en,
  nav .nav-inner:has(.mobile-nav-toggle) .brand small { display: none; }
}
@media (max-width: 900px) {
  nav .nav-inner:has(.mobile-nav-toggle) { grid-template-columns: minmax(0,1fr) auto auto; }
  nav .nav-inner:has(.mobile-nav-toggle) .theme-toggle { grid-row: 1; grid-column: 2; margin: 6px 4px; padding: 6px 8px; }
  nav .nav-inner .mobile-nav-toggle { grid-row: 1; grid-column: 3; }
  nav .nav-inner:has(.mobile-nav-toggle) .brand small { display: none; }
  .catalog-page .nav-inner { flex-wrap: wrap; padding: 0 12px; }
  .catalog-page .nav-inner > a { min-height: 48px; padding: 0 10px; }
  .admin-header, .viewer-header { flex-wrap: wrap; height: auto; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .site-head { flex-wrap: wrap; }
}
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111c28; --card: #1b2b3b; --text: #e4edf5; --text-light: #b3c4d3;
    --border: #455d70; --shadow: 0 2px 12px #0003;
    --ink: #e4edf5; --muted: #b3c4d3; --paper: #1b2b3b; --wash: #111c28;
    --line: #455d70; --blue: #9bcefa; --accent: #edbf69; --danger: #ffacaa;
    --teal: #196965; --teal-dark: #9fddd6; --orange: #edbf69;
    --catalog-ink: #e4edf5; --catalog-muted: #b3c4d3; --catalog-line: #455d70;
    --catalog-paper: #1b2b3b; --catalog-wash: #111c28;
    --catalog-teal: #196965; --catalog-teal-dark: #9fddd6; --catalog-copper: #edbf69;
    background: var(--bg); color: var(--text);
  }
  html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
  html[data-theme="dark"] :focus-visible { outline-color: #f5cb75; }
  html[data-theme="dark"] :is(input, select, textarea) { background: #132231; color: #e4edf5; border-color: #7890a5; }
  html[data-theme="dark"] ::placeholder { color: #abbfce; opacity: 1; }
  html[data-theme="dark"] :is(input, select, textarea):invalid { border-color: #ffacaa; }
  html[data-theme="dark"] :is(h2, h3, h4, summary, .section-title, .task-card strong, .sop-item strong, .visual-ref-card strong, .site-search label, .file-filter-panel label, .search-result-title) { color: #e4edf5; }
  html[data-theme="dark"] a { color: #9bcefa; }
  html[data-theme="dark"] :is(.ov-link, .process-step span, .flow-step .num, .search-result-meta) { color: #edbf69; }
  html[data-theme="dark"] [style*="color:#1a3c5e"] { color: #e4edf5 !important; }
  html[data-theme="dark"] :is([style*="color:#5b6b7a"], [style*="color:#647985"]) { color: #b3c4d3 !important; }
  html[data-theme="dark"] .admin-shell { --muted: #b3c4d3; }
  html[data-theme="dark"] :is(.panel-kicker, .catalog-product-index) { color: #edbf69; }
  html[data-theme="dark"] :is(.product-faq-item, .product-faq-category, .faq-checklist, .rule-list li, .product-faq-item[open] summary) { background: #233747; color: #e4edf5; }
  html[data-theme="dark"] .faq-decision-guide { background: #233747; border-color: #455d70; }
  html[data-theme="dark"] .faq-example { background: #3b3020; color: #ffe0a3; }
  html[data-theme="dark"] .faq-answer strong:first-child { color: #9bcefa; }
  html[data-theme="dark"] .callout strong { color: #d1edff; }
  html[data-theme="dark"] .callout.danger { background: #532e38; border-color: #ffacaa; }
  html[data-theme="dark"] .callout.danger strong { color: #ffc3c3; }
  html[data-theme="dark"] .callout.warning { background: #3b3020; border-color: #edbf69; }
  html[data-theme="dark"] .callout.warning strong { color: #ffe0a3; }
  html[data-theme="dark"] .catalog-document-cover .file-kind { color: #0d5658; }
  html[data-theme="dark"] .catalog-series-directory span { color: #b3c4d3; }
  html[data-theme="dark"] :is(.viewer-open, .secondary-button, .catalog-manage-card a, .catalog-manage-card button) { background: #233a4c; color: #c6e6ff; border-color: #7890a5; }
  html[data-theme="dark"] .viewer-error a { background: #225c7b; color: #fff; }
  html[data-theme="dark"] :is(nav, .hero, footer, .site-head) a { color: #fff; }
  html[data-theme="dark"] :is(.en, .section-title .en, figcaption, .swatch-summary, .managed-content-updated) { color: #b3c4d3; }
  html[data-theme="dark"] :is(.sidebar, .search-results, .sop-shot, .swatch-item, .tab-button, .section, .status, .admin-header, .admin-sidebar, .catalog-sidebar, .catalog-tab, .catalog-document, .catalog-manage-card, .content-block, .delete-dialog, .viewer-header, .viewer-intro, .viewer-error, .reader-toolbar) { background: #1b2b3b; color: #e4edf5; border-color: #455d70; }
  html[data-theme="dark"] :is(pre, .callout, .flooring-guide summary, .guide-toc a, .layer-list li, .process-line span, .line-results, .catalog-series-directory, .catalog-empty, .catalog-series-directory span, .viewer-meta span, .catalog-meta span, .delete-item-name) { background: #233a4c; color: #e4edf5; border-color: #455d70; }
  html[data-theme="dark"] :is(blockquote, .notice, .warning-card, .boundary-note, .template-link) { background: #3b3020; color: #ffe0a3; border-color: #b8914b; }
  html[data-theme="dark"] :is(.boundary-note, .warning-card, .notice, blockquote) .en { color: #e0cfac; }
  html[data-theme="dark"] :is(.boundary-note, .warning-card, .notice, blockquote) strong { color: inherit; }
  html[data-theme="dark"] tr:nth-child(even) { background: #233747; }
  html[data-theme="dark"] th { background: #233f58; color: #fff; }
  html[data-theme="dark"] button { background: #233a4c; color: #e4edf5; border-color: #7890a5; }
  html[data-theme="dark"] :is(button, .product-link, .search-result, .sidebar a, .doc-rail a, .doc-outline a):hover { background: #304f66; color: #fff; }
  html[data-theme="dark"] :is(button.primary, .primary-button, .catalog-tab.is-active, .viewer-download) { background: #225c7b; color: #fff; border-color: #6e9bb5; }
  html[data-theme="dark"] :is(.danger, .catalog-remove, .catalog-row button, .catalog-actions button:last-child) { color: #ffacaa; }
  html[data-theme="dark"] .danger-button { background: #8c3536; color: #fff; }
  html[data-theme="dark"] :is(.primary-action, .qe-card .btn, .back-top) { background: #edbf69; color: #1a2936; }
  html[data-theme="dark"] :is(.tag, .catalog-sidebar-head span, .admin-nav.is-active, .catalog-category-button.is-active, .catalog-series-directory span.has-docs, .tab-button[aria-selected="true"]) { background: #27495c; color: #d1edff; border-color: #7890a5; }
  html[data-theme="dark"] .tag.gold { background: #4a3920; color: #ffe0a3; }
  html[data-theme="dark"] .tag.green { background: #244939; color: #b9efd0; }
  html[data-theme="dark"] .tag.red { background: #532e38; color: #ffc3c3; }
  html[data-theme="dark"] :is(.catalog-category-button, .catalog-series-head span, .catalog-upload-date, .catalog-category-button small, .catalog-category-button .index, .admin-brand span, .admin-sidebar-title, .reader-status, .viewer-category, .toolbar-note, .catalog-manage-card p) { color: #b3c4d3; }
  html[data-theme="dark"] .reader { background: #111c28; border-color: #455d70; }
  html[data-theme="dark"] .business-directory .clickable-directory-card:hover { background: #294457; outline-color: #9bcefa; }
  html[data-theme="dark"] .summary .grand { color: #e4edf5; border-color: #7890a5; }
  /* Document paper remains white, including preview, with no image inversion. */
  html[data-theme="dark"] .quote-sheet { color-scheme: light; background: #fff; color: #172532; }
  html[data-theme="dark"] .quote-sheet :is(h1, h2, h3, h4, strong, td) { color: #172532; }
  html[data-theme="dark"] .quote-sheet tr { background: #fff; }
  html[data-theme="dark"] .quote-sheet th { background: #e9eef3; color: #172532; }
}
@media print {
  :root { color-scheme: light; }
  .theme-toggle { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
