/* One account preference controls the shell, forms and map controls.
   The existing light theme and map/photo imagery retain their original colors. */
.appearance-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
}
.appearance-control select {
  min-width: 110px;
  margin: 0;
}
.appearance-control[data-appearance-ready] select {
  display: none;
}
div.appearance-control:not([data-appearance-ready]) {
  visibility: hidden;
}
.appearance-toggle {
  border-radius: 50%;
}
.appearance-toggle:disabled {
  cursor: progress;
}
.appearance-sun,
[data-theme="dark"] .appearance-moon {
  display: none;
}
[data-theme="dark"] .appearance-sun {
  display: block;
}
.appearance-status--error {
  clip: auto;
  width: min(270px, 75vw);
  height: auto;
  margin: 0;
  top: calc(100% + 10px);
  right: 0;
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: var(--white);
  color: var(--danger);
  white-space: normal;
  font-size: 0.8rem;
  z-index: 120;
}
.login-topbar {
  align-items: center;
  gap: 12px;
}
.login-topbar .appearance-control {
  margin-right: auto;
}
.login-topbar .appearance-toggle {
  background: #102f39d9;
  border-color: #ffffff60;
  color: #fff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef2;
  --ink-dark: #f4f8fa;
  --paper: #101b22;
  --white: #182730;
  --muted: #afc0c8;
  --line: #3a515e;
  --accent: #d8b775;
  --danger: #ffb9ae;
  --surface-raised: #20343f;
  --surface-input: #14232d;
  --action-ink: #14242d;
}
[data-theme="dark"] .is-staff,
[data-theme="dark"] .is-customer {
  background: var(--paper);
}
[data-theme="dark"] .workspace-sidebar,
[data-theme="dark"] .mobile-drawer,
[data-theme="dark"] .project-workspace,
[data-theme="dark"] .person-list,
[data-theme="dark"] .project-card,
[data-theme="dark"] .map-section,
[data-theme="dark"] .map-tools,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .row-action,
[data-theme="dark"] .editor-sections a,
[data-theme="dark"] .work-project-list > .empty-state,
[data-theme="dark"] .mobile-no-script {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .app-header,
[data-theme="dark"] .site-header {
  background: #182730f2;
}
[data-theme="dark"] .workspace-nav-link,
[data-theme="dark"] .logout-button,
[data-theme="dark"] .nav-heading,
[data-theme="dark"] .search-field > .ui-icon,
[data-theme="dark"] .work-project-updated small,
[data-theme="dark"] .property-reference {
  color: var(--muted);
}
[data-theme="dark"] .eyebrow,
[data-theme="dark"] .workspace-context > span {
  color: var(--accent);
}
[data-theme="dark"] .workspace-nav-link:hover,
[data-theme="dark"] .workspace-nav-link.is-active,
[data-theme="dark"] .logout-button:hover,
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .row-action:hover,
[data-theme="dark"] .editor-sections a:hover,
[data-theme="dark"] .work-project-row:hover,
[data-theme="dark"] .view-switch,
[data-theme="dark"] .status-filter > span,
[data-theme="dark"] .search-summary,
[data-theme="dark"] .project-list-heading,
[data-theme="dark"] th,
[data-theme="dark"] .empty-icon,
[data-theme="dark"] .work-project-image,
[data-theme="dark"] .map-project-placeholder {
  background: var(--surface-raised);
  color: var(--ink);
}
[data-theme="dark"] .view-switch .is-active,
[data-theme="dark"] .status-filter.is-active > span {
  background: #344d5b;
  color: var(--ink);
}
[data-theme="dark"] input:not([type="hidden"]):not([type="checkbox"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .search-field input[type="search"] {
  background: var(--surface-input);
  color: var(--ink);
  border-color: #718d9b;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #a5bac6;
  opacity: 1;
}
[data-theme="dark"] .button,
[data-theme="dark"] .project-map-popup .map-project-link,
[data-theme="dark"] .project-map-popup .map-project-retry {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--action-ink);
}
[data-theme="dark"] .button:hover,
[data-theme="dark"] .project-map-popup .map-project-link:hover,
[data-theme="dark"] .project-map-popup .map-project-retry:hover {
  background: #edcf96;
  border-color: #edcf96;
}
[data-theme="dark"] .button--secondary {
  background: var(--white);
  border-color: #718d9b;
  color: var(--ink);
}
[data-theme="dark"] .button--secondary:hover,
[data-theme="dark"] .search-submit:hover {
  background: var(--surface-raised);
}
[data-theme="dark"] .notice {
  background: #173d2e;
  border-color: #367656;
  color: #b9edd1;
}
[data-theme="dark"] .notice--error {
  background: #4a2629;
  border-color: #a06666;
  color: #ffd0c8;
}
[data-theme="dark"] .badge {
  background: #403723;
  color: #f4d398;
}
[data-theme="dark"] .badge--green {
  background: #1a4035;
  color: #a0e1bf;
}
[data-theme="dark"] .image-placeholder {
  background: linear-gradient(135deg, #20343f, #344d5b);
  color: var(--ink);
}
[data-theme="dark"] .empty-state,
[data-theme="dark"] .mobile-header-search {
  border-color: var(--line);
}
[data-theme="dark"] .project-slider-controls button:disabled {
  background: var(--surface-raised);
  color: #92a8b4;
}
[data-theme="dark"] :focus-visible {
  outline-color: #edcf96;
}
[data-theme="dark"] .skip-link {
  color: var(--action-ink);
}
[data-theme="dark"] .portal-pin span {
  background: #193b46;
}
[data-theme="dark"] .portal-pin--selected span {
  background: #8a642d;
}
[data-theme="dark"] .map,
[data-theme="dark"] .map-fullscreen[open] {
  background: var(--paper);
}
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip,
[data-theme="dark"] .map-shell .leaflet-control-zoom a,
[data-theme="dark"] .project-map-popup a.leaflet-popup-close-button {
  background: var(--white);
  color: var(--ink);
}
[data-theme="dark"] .map-shell .leaflet-control-zoom,
[data-theme="dark"] .map-tools {
  border-color: var(--line);
}
[data-theme="dark"] .map-tool:hover,
[data-theme="dark"] .map-shell .leaflet-control-zoom a:hover {
  background: var(--surface-raised);
}
[data-theme="dark"] .project-map-popup .map-project-description {
  color: var(--muted);
}
[data-theme="dark"] .map-shell .leaflet-control-scale-line,
[data-theme="dark"] .leaflet-control-attribution {
  background: #182730ed;
  color: var(--ink);
  border-color: #afc0c8;
}
[data-theme="dark"] .leaflet-control-attribution a {
  color: #c3e4f5;
}
[data-theme="dark"] .is-login .login-card {
  background: linear-gradient(145deg, #182d39eb, #101e28e6);
  border-color: #91a9b8;
  box-shadow:
    0 24px 70px #0007,
    inset 0 1px 0 #a4bec733;
}
[data-theme="dark"] .is-login .login-card::before {
  opacity: 0.2;
}
[data-theme="dark"] .is-login .login-card input:not([type="hidden"]) {
  background: #101e28cc;
  border-color: #91a9b8;
  color: var(--ink);
}
[data-theme="dark"] .is-login .login-card input:focus {
  background: #101e28;
}
@supports not (backdrop-filter: blur(1px)) {
  [data-theme="dark"] .is-login .login-card {
    background: #182730;
  }
}
@media (prefers-reduced-transparency: reduce) {
  [data-theme="dark"] .is-login .login-card {
    background: #182730;
  }
}
@media (max-width: 600px) {
  .app-header-actions {
    gap: 6px;
  }
  .appearance-control .icon-button {
    width: 40px;
    height: 40px;
  }
}
