/* Shared theme controls; photographs and brand artwork are never inverted. */
:root { color-scheme: light; --theme-focus: #a84600; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 44px; width: 44px; min-height: 44px; padding: 10px;
  border: 1px solid #76736d; border-radius: 9px;
  background: transparent; color: inherit; cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: #eae7de; }
.theme-toggle:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
.theme-toggle svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun, .brand .logo-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-moon,
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun,
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.topbar .theme-toggle { color: #f4f1eb; border-color: #8d8982; background: #242424; }
.topbar .theme-toggle:hover { background: #353535; }

:root[data-theme="dark"] {
  color-scheme: dark; color: #f4f1eb; background: #121212;
  --ink: #f4f1eb; --paper: #121212; --cream: #202020;
  --muted: #b8b5ad; --line: #484642; --green: #bad0bb;
  --orange-dark: #ffab66; --theme-focus: #ffab66;
  --theme-surface: #202020; --theme-raised: #292929;
  --theme-input: #191919; --theme-control-border: #76736d;
  --theme-success-bg: #243027; --theme-success-text: #c2ddc6;
  --theme-warm-bg: #382a20; --theme-warm-text: #f5cba6;
  --theme-error-bg: #382421; --theme-error-text: #ffc5b8;
}
:root[data-theme="dark"] body { color: var(--ink); background: var(--paper); }
:root[data-theme="dark"] :is(button,a,input,select,summary,textarea):focus-visible { outline-color: var(--theme-focus); }
:root[data-theme="dark"] .header { background: rgba(18,18,18,.97); }
:root[data-theme="dark"] :is(.header nav,.hero-text,.visual-caption,.field-label,.promise,.amenities,.price p,.card-review,.step-num,.steps p,.verification-box p,.about-copy>p:not(.eyebrow),.lead-story p,.gallery-images figcaption) { color: var(--muted); }
:root[data-theme="dark"] .hero-title-period { color: var(--ink); }
:root[data-theme="dark"] :is(.hero-search,.card,.detail-contact,.draft-output,.dataset,.filter-chip,.save-btn) { background: var(--theme-surface); color: var(--ink); }
:root[data-theme="dark"] :is(.filters,.trust,footer,.empty,.detail-summary,.facility-list span,.policy-note,.review-empty,.map-placeholder,.info-card,.rates-table thead,.close-modal,.count) { background: var(--theme-raised); }
:root[data-theme="dark"] :is(.verification-box,.steps article,.verification-aside,.price,.empty) { border-color: var(--line); }
:root[data-theme="dark"] .dataset .selected { background: #41403c; color: var(--ink); box-shadow: inset 0 0 0 1px #ffab66; }
:root[data-theme="dark"] .card-art { background: #292b29; }
:root[data-theme="dark"] .art-label { background: rgba(18,18,18,.93); color: var(--ink); }
:root[data-theme="dark"] .card-bottom .btn { background: var(--theme-raised); color: var(--ink); border-color: var(--theme-control-border); }
:root[data-theme="dark"] :is(.saved-nav,.btn.subtle,.btn.dark,.filter-chip) { border-color: var(--theme-control-border); }
:root[data-theme="dark"] :is(.saved-nav[aria-pressed="true"],.save-btn.saved) { background: var(--theme-warm-bg); color: var(--theme-warm-text); }
:root[data-theme="dark"] .save-btn.saved .icon { fill: var(--theme-warm-bg); }
:root[data-theme="dark"] :is(.theme-toggle:hover,.btn.subtle:hover) { background: #3b3935; }
:root[data-theme="dark"] :is(.hero-search input,.hero-search select,.filter-label input,.filter-label select,.draft-form input,.draft-form select,.draft-form textarea,.draft-output textarea) { background: var(--theme-input); color: var(--ink); border-color: var(--theme-control-border); }
:root[data-theme="dark"] .sort-label select { color: var(--ink); }
:root[data-theme="dark"] :is(input,textarea)::placeholder { color: #aaa69e; opacity: 1; }
:root[data-theme="dark"] .pills span { background: var(--theme-input); border-color: var(--theme-control-border); }
:root[data-theme="dark"] .pills input:checked+span { background: #f4f1eb; color: #121212; border-color: #f4f1eb; }
:root[data-theme="dark"] :is(.badge,.badge.project,.data-notice) { color: var(--theme-success-text); background: var(--theme-success-bg); }
:root[data-theme="dark"] .data-notice { border-color: #607362; }
:root[data-theme="dark"] .data-notice .text-btn { color: var(--theme-success-text); }
:root[data-theme="dark"] :is(.badge.reference,.badge.archive,.badge.demo,.badge.planned,.data-notice.demo,.proximity-context,.campus-distance) { background: var(--theme-warm-bg); color: var(--theme-warm-text); }
:root[data-theme="dark"] :is(.data-notice.demo,.proximity-context) { border-color: #826344; }
:root[data-theme="dark"] :is(.proximity-context>strong,.proximity-context p,.proximity-context a) { color: var(--theme-warm-text); }
:root[data-theme="dark"] .campus-distance.unconfirmed { background: var(--theme-raised); color: var(--muted); }
:root[data-theme="dark"] .detail-summary>p { color: var(--muted); }
:root[data-theme="dark"] .compare-table th:first-child { background: var(--theme-raised); }
:root[data-theme="dark"] .compare-table thead th:not(:first-child) { background: var(--theme-surface); }
:root[data-theme="dark"] dialog::backdrop { background: rgba(0,0,0,.72); }

/* Ask Ash follows the same palette, including questions and the reply field. */
:root[data-theme="dark"] .ash-widget { color: var(--ink); }
:root[data-theme="dark"] :is(.ash-panel,.ash-form) { background: var(--theme-surface); border-color: var(--line); }
:root[data-theme="dark"] .ash-message { background: var(--theme-raised); border-color: #56534e; }
:root[data-theme="dark"] :is(.ash-message-name,.ash-message a,.ash-footer button) { color: var(--theme-warm-text); }
:root[data-theme="dark"] .ash-message-user { background: var(--theme-warm-bg); border-color: #826344; }
:root[data-theme="dark"] .ash-message-user .ash-message-name { color: var(--theme-warm-text); }
:root[data-theme="dark"] :is(.ash-topics>p,.ash-input-label,.ash-footer) { color: var(--muted); }
:root[data-theme="dark"] :is(#ash-topic-list button,.ash-form input) { background: var(--theme-input); border-color: var(--theme-control-border); color: var(--ink); }
:root[data-theme="dark"] #ash-topic-list button:hover { background: var(--theme-warm-bg); border-color: #ffab66; }
:root[data-theme="dark"] .ash-position-controls { background: var(--theme-surface); border-color: var(--line); }
:root[data-theme="dark"] .ash-position-controls button { background: var(--theme-input); color: var(--ink); border-color: var(--theme-control-border); }
:root[data-theme="dark"] .ash-position-controls button:hover { background: var(--theme-warm-bg); }

/* The owner dashboard shares the preference and keeps its existing access checks. */
:root[data-theme="dark"] :is(.library,.editor,.stats button,.page-admin button:not(.primary):not(.theme-toggle)) { background: var(--theme-surface); color: var(--ink); }
:root[data-theme="dark"] :is(.account,.editor-actions,.listing-item,.choices label) { background: var(--theme-raised); }
:root[data-theme="dark"] .listing-item.active { background: var(--theme-warm-bg); }
:root[data-theme="dark"] :is(.editor-note,.page-admin footer,.tag) { color: var(--muted); }
:root[data-theme="dark"] :is(.tag.draft,.preview-source) { color: var(--theme-warm-text); }
:root[data-theme="dark"] .tag.published { color: var(--theme-success-text); }
:root[data-theme="dark"] .tag.hidden { color: var(--muted); }
:root[data-theme="dark"] :is(input,select,textarea) { background: var(--theme-input); border-color: var(--theme-control-border); color: var(--ink); }
:root[data-theme="dark"] .notice { background: var(--theme-success-bg); color: var(--theme-success-text); border-color: #607362; }
:root[data-theme="dark"] .notice.error { background: var(--theme-error-bg); color: var(--theme-error-text); border-color: #b3867c; }
:root[data-theme="dark"] .danger { color: var(--theme-error-text); }
:root[data-theme="dark"] .preview-source { background: var(--theme-warm-bg); }
:root[data-theme="dark"] #preview-dialog { background: var(--theme-surface); color: var(--ink); }
:root[data-theme="dark"] .page-admin .eyebrow { color: var(--orange-dark); }
:root[data-theme="dark"] .inbox { background: var(--theme-surface); }
:root[data-theme="dark"] :is(.inbox-item,.inbox-detail,.trust-callout,.confirmation-note) { background: var(--theme-raised); }
:root[data-theme="dark"] .submission-error { background: var(--theme-error-bg); color: var(--theme-error-text); border-color: #b3867c; }
@media(max-width:600px) {
  .header-inner { gap: 8px; }
  .saved-nav { padding-left: 8px; padding-right: 8px; gap: 4px; }
}
