/* Readable neutral glass, restrained colour for actions, status and selection. */
:root,
body[data-style] {
  --glass: rgba(30, 31, 33, 0.84);
  --glass-line: rgba(255, 255, 255, 0.14);
  --muted: #b8bbc1;
  --control-surface: #323438;
  --paper: #17181a;
  --accent: #74adff;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body :is(button, input, select, textarea) {
  border-radius: 9px;
  font: inherit;
  font-size: calc(12px * var(--text-scale, 1));
}
body :is(button, input, select, textarea):focus-visible {
  outline: 2px solid #91bcff !important;
  outline-offset: 3px;
}
body :is(input, select, textarea),
body :is(input, textarea)::placeholder {
  color: #f0f1f4 !important;
}
body :is(input, textarea)::placeholder {
  color: #aeb3bd !important;
  opacity: 1;
}
body :is(button, .list-card, .property-group, .feature-entry, .settings-info) {
  border-color: #ffffff24 !important;
}
body :is(button:hover, summary:hover) {
  background: #3b3e43 !important;
  color: #fff !important;
}
body
  :is(
    button.primary,
    button[aria-pressed="true"],
    button[aria-selected="true"],
    .settings-nav button.active
  ) {
  background: #293c57 !important;
  border-color: #83b5ff !important;
  color: #ecf4ff !important;
  box-shadow: inset 0 0 0 1px #83b5ff44;
}
body button:disabled {
  opacity: 0.55;
}
body
  :is(
    .header,
    .rail,
    .explorer,
    .inspector,
    .timeline-panel,
    .selection-drawer,
    .site-gallery,
    dialog
  ) {
  box-shadow: 0 12px 45px #00000024;
}
body[data-style="glassy"]
  :is(
    .explorer,
    .inspector,
    .timeline-panel,
    .selection-drawer,
    .viewport-heading-chip,
    .kpis article
  ) {
  background: rgba(29, 30, 32, 0.83) !important;
  backdrop-filter: blur(22px) saturate(0.3);
}
body :is(.badge, .plain-badge, .notice, .status-pill) {
  background: #292c31 !important;
  color: #dce2eb !important;
}
body :is(.notice.amber, .notice.warning, .badge.alert) {
  background: #342d42 !important;
  color: #e4d8fb !important;
  border-color: #9f8ec2 !important;
}
body :is(.eyebrow, .viewport-top small, .viewport-hint) {
  letter-spacing: 0.04em;
  font-size: calc(11px * var(--text-scale, 1));
}
body .viewport-tools button {
  min-width: 34px;
  min-height: 34px;
}
.weather-dock {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 8;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
body .weather-dock button {
  background: rgba(34, 36, 40, 0.92) !important;
  color: #edf1f7 !important;
  border: 1px solid #ffffff35;
  padding: 8px 11px;
  box-shadow: 0 4px 18px #0003;
  backdrop-filter: blur(16px);
  white-space: nowrap;
}
.weather-summary {
  padding: 16px;
  border: 1px solid #ffffff25;
  border-radius: 14px;
  background: #26282c;
  margin-bottom: 16px;
}
.weather-summary h3 {
  font-size: calc(26px * var(--text-scale, 1));
  margin: 10px 0;
}
.weather-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.weather-metrics span,
.managed-twin-list article span {
  display: grid;
  gap: 5px;
}
.managed-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.managed-heading p {
  margin-top: 0;
  color: #bbc0c9;
}
.managed-catalog {
  margin: 18px 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ffffff25;
}
.managed-twin-card {
  overflow: hidden;
  border: 1px solid #ffffff25;
  border-radius: 16px;
  background: #282b30;
}
.managed-twin-card > :is(svg, img) {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.managed-twin-card > div {
  padding: 16px;
}
.managed-twin-card h3 {
  margin: 8px 0 14px;
}
.managed-twin-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  margin: 16px 0 24px;
}
.managed-twin-list article {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ffffff22;
  border-radius: 12px;
  padding: 12px;
  background: #282b30;
}
.managed-twin-list article span {
  flex: 1;
}
body .placement-prompt {
  position: absolute;
  z-index: 12;
  bottom: 64px;
  left: 16px;
  padding: 12px;
  border-radius: 12px;
  background: #28364c;
  border: 1px solid #93b9f2;
  color: #eff5ff;
  max-width: min(360px, 85%);
}
@media (max-width: 700px) {
  .weather-dock {
    bottom: 10px;
    left: 8px;
  }
  .weather-dock button {
    padding: 6px !important;
    font-size: calc(11px * var(--text-scale, 1));
  }
  .weather-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .managed-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }
}

body .viewport-tools > .weather-dock {
  display: flex !important;
  position: static;
  gap: 6px;
}
body .viewport-tools > .weather-dock[hidden] {
  display: none !important;
}
body .viewport-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: calc(100vw - 50px);
}
body .weather-dock button {
  box-shadow: none;
  min-height: 34px;
}
body .viewport-tools .weather-dock button {
  width: auto;
  height: 34px;
  min-width: 68px;
  padding: 6px 10px;
  font-size: calc(12px * var(--text-scale, 1));
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body
  :is(
    .inspector .data-row,
    .inspector .meta-row,
    .inspector dl,
    .inspector .small-label
  ) {
  font-size: calc(12px * var(--text-scale, 1));
}
body[data-style]
  #dialog
  :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(
        [type="color"]
      ),
    select,
    textarea
  ) {
  background: #2d2f33 !important;
  border-color: #777d88 !important;
  color-scheme: dark !important;
}
body input::file-selector-button {
  background: #35383e;
  color: #f0f3f7;
  border: 1px solid #7c838e;
  border-radius: 6px;
  padding: 6px 9px;
  margin-right: 10px;
}
body[data-style] #dialog .theme-preview:has(input:checked) {
  background: #293c57 !important;
  border: 2px solid #91bcff !important;
  box-shadow: 0 0 0 2px #91bcff33 !important;
}
body #viewport-background[aria-pressed="true"] {
  background: #293c57 !important;
  border-color: #91bcff !important;
}
body
  :is(
    .managed-twin-list small,
    .managed-twin-card small,
    .weather-summary small
  ) {
  color: #c1c6cf;
  font-size: calc(12px * var(--text-scale, 1));
}

body[data-style="glassy"] .placement-prompt {
  left: calc(var(--explorer-width) + 102px);
  top: 203px;
  bottom: auto;
}
body[data-style="glassy"][data-layout="focus"] .placement-prompt {
  left: 95px;
}
@media (max-width: 950px) {
  body[data-style="glassy"] .placement-prompt {
    left: 90px;
    top: 240px;
  }
}

body[data-style="classic"] :is(.viewport-panel, .viewport-top) {
  background: #202226 !important;
}
body[data-style] #timeline {
  accent-color: var(--accent, #74adff);
}
body #weather-config > label:not(.checkbox-field) {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}
body #weather-config select {
  width: 100%;
  padding: 10px;
}
body hr {
  border: 0;
  border-top: 1px solid #ffffff28;
  margin: 20px 0;
}
body
  :is(
    .leaflet-popup-content-wrapper,
    .leaflet-popup-tip,
    .leaflet-tooltip,
    .leaflet-control-layers,
    .leaflet-control-attribution,
    .leaflet-bar a
  ) {
  background: #2d2f33 !important;
  color: #eff2f6 !important;
  border-color: #ffffff35 !important;
}
body :is(.leaflet-popup-content a, .leaflet-control-attribution a) {
  color: #98c0ff !important;
}

body .dialog-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
body .dialog-navigation button {
  background: #303238 !important;
  color: #f0f3f7 !important;
  border: 1px solid #ffffff35 !important;
  font-size: calc(13px * var(--text-scale, 1));
  min-height: 36px;
  padding: 7px 11px;
}
body .dialog-navigation button:disabled {
  opacity: 0.42;
  cursor: default;
}
body #dialog-trail {
  margin: 0;
  padding: 9px 24px;
  border-bottom: 1px solid #ffffff20;
  color: #c9ced7;
  font-size: calc(12px * var(--text-scale, 1));
  overflow-wrap: anywhere;
}
body #dialog-trail:empty {
  display: none;
}
/* Keep an exit in reach even when a long menu is scrolled. */
body #dialog > .dialog-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #232427 !important;
  box-shadow:
    0 -26px 0 #232427,
    0 8px 16px #00000020;
}
body .site-gallery > .gallery-heading {
  position: sticky;
  top: -30px;
  z-index: 5;
  background: #232427 !important;
  margin: -30px -38px 22px;
  padding: 16px 24px;
  border-bottom: 1px solid #ffffff24;
  box-shadow: 0 8px 18px #00000025;
}
body #gallery-close {
  min-height: 40px;
  min-width: 120px;
  background: #34373d !important;
  color: #f0f3f7 !important;
  font-size: calc(14px * var(--text-scale, 1));
  border: 1px solid #ffffff40 !important;
}
body .selection-drawer > header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #232427 !important;
}
body.sites-open .selection-drawer {
  visibility: hidden;
  pointer-events: none;
}
body .leaflet-popup-close-button {
  min-width: 28px;
  min-height: 28px;
  color: #f0f3f7 !important;
}
body .viewport-heading-chip,
body .viewport-heading-chip button {
  pointer-events: auto;
}

/* Weather artwork is local SVG; panels and every text surface stay neutral. */
body .viewport-tools {
  flex-wrap: wrap;
  z-index: 6;
}
body .viewport-tools .weather-mini,
body .viewport-tools .context-clocks span {
  border: 0;
  padding: 0;
}
body #viewport-weather {
  height: auto !important;
  min-height: 58px;
  gap: 6px;
  text-align: left;
}
.weather-art {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: visible;
}
.weather-mini {
  display: grid;
  gap: 2px;
}
.weather-mini strong {
  font-size: calc(18px * var(--text-scale, 1));
  font-weight: 600;
}
.weather-mini small {
  font-size: calc(11px * var(--text-scale, 1));
  color: #c4ccd8;
  white-space: normal;
  max-width: 140px;
}
.weather-hero {
  display: flex;
  align-items: center;
  gap: 22px;
}
.weather-hero > .weather-art {
  width: 136px;
  height: 136px;
  flex-basis: 136px;
  filter: drop-shadow(0 8px 14px #0003);
}
.weather-hero > div {
  display: grid;
  gap: 6px;
}
body .weather-summary h3 {
  font-size: calc(52px * var(--text-scale, 1));
  line-height: 1;
  margin: 0;
  letter-spacing: -2px;
  color: #f4f6fa;
}
body .weather-summary h3 small {
  font-size: calc(24px * var(--text-scale, 1));
  letter-spacing: 0;
  color: #bac5d4;
}
.weather-location {
  font-size: calc(13px * var(--text-scale, 1));
  color: #c2cad6;
}
.weather-source-tag {
  font-size: calc(11px * var(--text-scale, 1));
  color: #aebacc;
  letter-spacing: 0.06em;
}
.context-clocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-width: 100%;
  width: 330px;
}
body .viewport-tools > .context-clocks:not([hidden]) {
  display: grid !important;
}
body[data-style="glassy"] .viewport-tools {
  max-width: min(385px, calc(100vw - 120px));
}
body[data-style="glassy"][data-layout="focus"] .viewport-tools {
  max-width: min(385px, calc(100vw - 125px));
}
body[data-style="classic"] .viewport-tools {
  max-width: min(385px, calc(100% - 28px));
  right: auto;
}
.clock-card {
  background: #292c31;
  border: 1px solid #ffffff26;
  border-radius: 10px;
  padding: 7px 10px;
  display: grid;
  gap: 3px;
  min-width: 0;
}
.clock-card > span {
  color: #c4ccd8;
  font-size: calc(11px * var(--text-scale, 1));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clock-card > time {
  font-size: calc(17px * var(--text-scale, 1));
  line-height: 1.1;
  font-weight: 600;
  color: #f1f5fb;
  font-variant-numeric: tabular-nums;
}
.clock-card > small {
  font-size: calc(11px * var(--text-scale, 1));
  color: #bdc7d5;
  white-space: nowrap;
}
body .dialog-heading {
  flex-wrap: wrap;
}
body .dialog-clocks {
  order: 3;
  width: 100%;
}
body .dialog-clocks .clock-card {
  grid-template-columns: auto 1fr;
  align-items: center;
}
body .dialog-clocks .clock-card > span {
  grid-column: 1 / -1;
}
body .dialog-clocks .clock-card > small {
  text-align: right;
  white-space: normal;
}
body.locked .context-clocks {
  display: none !important;
}
.wx-cloud {
  animation: weather-drift 7s ease-in-out infinite;
}
.wx-rain,
.wx-snow {
  animation: weather-drift 3s ease-in-out infinite;
}
@keyframes weather-drift {
  50% {
    transform: translateY(2px);
  }
}
body.reduce-motion .weather-art * {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .weather-art * {
    animation: none !important;
  }
}
@media (max-width: 600px) {
  .context-clocks {
    width: 100%;
  }
  .weather-hero {
    gap: 12px;
  }
  .weather-hero > .weather-art {
    width: 96px;
    height: 96px;
    flex-basis: 96px;
  }
  body .dialog-clocks .clock-card {
    display: grid;
    grid-template-columns: 1fr;
  }
  body .dialog-clocks .clock-card > small {
    text-align: left;
  }
}
@media (max-width: 600px) {
  body .dialog-heading {
    flex-wrap: wrap;
    gap: 12px;
  }
  body .dialog-navigation {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Explicit current/replay status and the same colours used by the p5 chart. */
body[data-style] #go-live[data-state="live"] {
  background: #20362c !important;
  color: #e7fff0 !important;
  border-color: #58c989 !important;
}
body[data-style] #go-live[data-state="replay"] {
  background: #48242b !important;
  color: #ffe8ed !important;
  border-color: #f07589 !important;
}
body[data-style] #go-live[data-state="replay"] i {
  background: #ff8295 !important;
}
body[data-style] #go-live[data-state="live"] i {
  background: #65df9d !important;
}
body[data-style] .timeline-key i {
  background: var(--accent, #74adff) !important;
}
body[data-style] .timeline-key b {
  background: #efa858 !important;
  border-radius: 50%;
}
.heatmap-legend {
  position: absolute;
  z-index: 7;
  left: 16px;
  bottom: 30px;
  width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  display: grid;
  gap: 7px;
  background: rgba(31, 32, 35, 0.96);
  color: #f3f4f7;
  border: 1px solid #666970;
  border-radius: 12px;
  font-size: calc(12px * var(--text-scale, 1));
  box-shadow: 0 8px 30px #0005;
}
.heatmap-legend[hidden] {
  display: none !important;
}
.heatmap-legend small {
  color: #c3c7d0;
  font-size: calc(11px * var(--text-scale, 1));
}
.heatmap-scale {
  display: flex;
  align-items: center;
  gap: 8px;
}
.heatmap-scale i {
  height: 8px;
  flex: 1;
  border-radius: 8px;
  background: linear-gradient(90deg, #438eff, #e2d553, #ff514f);
}
.heatmap-selected {
  padding-top: 6px;
  border-top: 1px solid #555963;
}
body[data-style="glassy"] .heatmap-legend {
  left: calc(var(--explorer-width, 230px) + 103px);
  bottom: calc(var(--timeline-height, 132px) + 50px);
  max-width: calc(
    100vw - var(--explorer-width, 230px) - var(--inspector-width, 270px) - 125px
  );
}
@media (max-width: 850px) {
  body[data-style="glassy"] .heatmap-legend {
    left: 85px;
    max-width: calc(100vw - 110px);
    bottom: calc(var(--timeline-height, 132px) + 50px);
  }
}

body .site-gallery {
  inset: 90px 8vw auto;
  max-height: calc(100vh - 120px);
  padding: 24px;
  width: auto;
  overflow-x: hidden;
}
body .site-gallery > .gallery-heading {
  top: -24px;
  margin: -24px -24px 22px;
}
body .compact-twin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.8fr);
  gap: 20px;
  align-items: stretch;
}
body .single-example .site-presentation {
  width: 100%;
  display: grid;
  grid-template-columns: 46% 1fr;
  text-align: left;
  height: 100%;
}
body .single-example .site-presentation svg {
  width: 100%;
  height: 100%;
  min-height: 190px;
}
body .new-twin-slot {
  background: #2a2b2f;
  border: 1px solid #62656d;
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
body .new-twin-slot h2 {
  margin: 0;
  color: #f3f5f8;
}
body .new-twin-slot p,
body .new-twin-slot small {
  margin: 0;
  color: #c9cdd5;
}
body .managed-catalog:empty {
  display: none;
}
body .building-part-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  margin-top: 6px;
  background: #30343b !important;
  color: #edf4ff !important;
  border: 1px solid #596373;
}
body .heatmap-legend details {
  display: grid;
  gap: 5px;
}
body .heatmap-legend summary {
  cursor: pointer;
  color: #cdd6e5;
}
body .heatmap-legend details span,
body .heatmap-legend details small {
  display: block;
  margin-top: 7px;
}
@media (max-width: 800px) {
  body .compact-twin-grid {
    grid-template-columns: 1fr;
  }
  body .site-gallery {
    inset: 85px 15px auto;
  }
  body .single-example .site-presentation {
    grid-template-columns: 1fr;
  }
  body .single-example .site-presentation svg {
    min-height: 100px;
    height: 120px;
  }
}
/* Shared text scaling; fixed 3D geometry and chart axes remain independent. */
:root {
  --text-scale: 1;
}
html {
  font-size: calc(16px * var(--text-scale));
}
body[data-style="glassy"] .command-bar {
  left: calc(var(--header-brand-width, 180px) + 50px);
  right: calc(var(--header-account-width, 280px) + 40px);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
body[data-style="glassy"] .viewport-top .kpis article,
body[data-style="glassy"] .viewport-top .viewport-heading-chip {
  height: calc(44px * var(--text-scale));
}
body[data-style="glassy"] .viewport-tools {
  top: max(150px, calc(150px + 160px * (var(--text-scale) - 1)));
}
@media (max-width: 1450px) {
  body[data-style="glassy"] #domain-status {
    display: none;
  }
}
body[data-style="glassy"] .header-right {
  gap: 12px;
  flex-shrink: 0;
}
body[data-style] #connection {
  display: inline-flex !important;
  position: static;
  flex-shrink: 0;
  white-space: nowrap;
  font-size: calc(10px * var(--text-scale)) !important;
  gap: 5px;
}
body #text-scale {
  width: 100%;
  min-height: 30px;
  accent-color: #70a4f8;
}
body #text-scale-value {
  margin-left: 12px;
  color: #b9d4ff;
  font-variant-numeric: tabular-nums;
}

/* Twins is a dedicated opaque page; operational surfaces stay out of sight. */
body.sites-open > :not(#site-gallery):not(dialog):not(script) {
  visibility: hidden !important;
}
body.sites-open #site-gallery {
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-height: none;
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  background: #232427 !important;
  backdrop-filter: none;
  padding: 24px clamp(18px, 6vw, 100px);
}
body.sites-open #site-gallery > .gallery-heading {
  top: -24px;
  margin: -24px 0 24px;
  padding: 24px 0 18px;
  background: #232427 !important;
}
body .layout-buttons .guide-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid #62656d;
  border-radius: 8px;
  background: #303236;
  color: #f3f5f8;
  text-decoration: none;
  font-size: calc(12px * var(--text-scale, 1));
  white-space: nowrap;
}
body .layout-buttons .guide-link:hover {
  background: #41444a;
}
body .layout-buttons .guide-link:focus-visible {
  outline: 2px solid #8fbbff;
  outline-offset: 3px;
}

body .selected-name-callout {
  position: fixed;
  z-index: 50;
  font-size: calc(12px * var(--text-scale, 1));
  background: #25282e !important;
  color: #f4f6fa !important;
  border: 1px solid #9aa7bb !important;
  box-shadow: 0 5px 18px #0006;
  pointer-events: none;
  max-width: min(300px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.locked .selected-name-callout {
  display: none !important;
}
