/* Map-first workspace. Auth and object-detail styles live in styles.css. */
#app {
  height: 100dvh;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
#app header {
  flex: 0 0 auto;
  padding: 8px 16px;
  gap: 16px;
  z-index: 1100;
}
#app .brand {
  font-size: 20px;
}
#app .brand-frame,
#app .brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}
#app .counters {
  display: flex;
  width: auto;
  gap: 6px;
  overflow-x: auto;
}
#app .counter {
  min-height: 40px;
  padding: 6px 12px;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
#app .counter b {
  font-size: 18px;
}
#app .counter span {
  font-size: 12px;
}
#app .header-actions {
  flex-shrink: 0;
}
.fire-alarm {
  position: fixed;
  z-index: 1050;
  top: 72px;
  left: 50%;
  width: min(1080px, calc(100vw - 40px));
  min-height: 150px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 18px 72px 18px 32px;
  border: 5px solid #fff;
  border-radius: 22px;
  color: #fff;
  background: #d50019;
  box-shadow: 0 16px 70px #000c, 0 0 0 8px #d5001966;
  cursor: pointer;
  animation: fire-alarm-pulse 0.8s steps(2, jump-none) infinite;
}
.fire-alarm[hidden] {
  display: none;
}
.fire-alarm-label {
  font-size: clamp(54px, 6vw, 104px);
  line-height: 0.95;
  font-weight: 1000;
  letter-spacing: 0.08em;
}
.fire-alarm-details {
  font-size: clamp(16px, 1.35vw, 25px);
  font-weight: 800;
}
.fire-alarm-close {
  position: absolute;
  top: 8px;
  right: 18px;
  font-size: 44px;
  line-height: 1;
}
@keyframes fire-alarm-pulse {
  50% {
    background: #62000b;
    box-shadow: 0 16px 70px #000c, 0 0 0 12px #ff233c99;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fire-alarm {
    animation: none;
  }
}
#mapMenu {
  position: relative;
}
#mapMenu summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
#mapMenu summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.menu-content {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  display: grid;
  min-width: 230px;
  gap: 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.menu-content .muted {
  overflow-wrap: anywhere;
}
#app .healthbar {
  position: absolute;
  right: 58px;
  bottom: 26px;
  margin: 0;
  padding: 5px 8px;
  z-index: 600;
  max-width: min(540px, calc(100% - 28px));
  background: var(--panel);
  font-size: 11px;
}
#app .healthbar:not(.stale) #freshness {
  display: none;
}
#app .healthbar:not(.stale) {
  border: 0;
  background: transparent;
  right: 12px;
  bottom: 28px;
  padding: 0;
}
#app .healthbar button {
  min-height: 36px;
  font-size: 12px;
}
#app main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
}
#app .map-panel {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
/* Docked, non-modal store card: the map has its own usable space. */
#app.details-open main {
  grid-template-columns: minmax(0, 1fr) clamp(380px, 24vw, 640px);
}
#app #details {
  position: relative;
  inset: auto;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  overscroll-behavior: contain;
}
#app #details .detail-head {
  padding: 18px;
  gap: 12px;
}
#app #details .detail-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
#app #detailBody {
  flex: 1;
  padding: 16px;
  align-content: start;
  overscroll-behavior: contain;
}
#app #details .detail-grid {
  grid-template-columns: minmax(0, 1fr);
}
#app #details .detail-actions {
  padding: 12px 16px;
  flex-wrap: wrap;
}
#app #details .detail-actions > * {
  flex: 1 1 140px;
}
#app #detailFreshness {
  padding: 10px 18px 0;
}
@media (max-width: 720px) {
  .fire-alarm {
    top: 64px;
    width: calc(100vw - 20px);
    min-height: 110px;
    padding: 14px 52px 14px 18px;
  }
  #app.details-open main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(170px, 44%) minmax(0, 1fr);
  }
  #app #details {
    grid-column: 1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  #app #details .detail-head {
    padding: 10px 14px;
  }
  #app #details .detail-head h2 {
    font-size: 20px;
  }
  #app #details .detail-head .eyebrow {
    display: none;
  }
  #app #details .detail-actions {
    padding: 8px 12px;
    gap: 8px;
  }
  #app #details .detail-actions > * {
    width: auto;
  }
}
#app .object-panel {
  position: absolute;
  left: 14px;
  top: 72px;
  bottom: 68px;
  width: min(360px, calc(100% - 28px));
  z-index: 700;
  min-height: 0;
  box-shadow: var(--shadow);
}
#app .object-list {
  min-height: 0;
  max-height: none;
}
#app .searchbox {
  padding: 14px;
}
#app .searchbox label,
#app .searchbox input {
  font-size: 14px;
}
#app .list-meta,
#app .list-meta button {
  font-size: 12px;
}
#app .object-card {
  padding: 14px;
}
#app .object-card strong {
  font-size: 16px;
}
#app .object-card p {
  font-size: 13px;
}
#app .object-card .signal,
#app .panel-note {
  font-size: 11px;
}
#app .map-tools {
  top: 12px;
  left: 14px;
  right: 70px;
  gap: 8px;
  pointer-events: none;
}
#app .map-tools > * {
  pointer-events: auto;
}
#app .map-tools button,
#app .map-tools span {
  font-size: 14px;
}
#app .map-legend {
  bottom: 26px;
  left: 14px;
  padding: 8px 12px;
  gap: 6px;
  font-size: 12px;
}
#app .map-legend .dot {
  width: 8px;
  height: 8px;
}
.cluster-choices {
  display: grid;
  gap: 6px;
  max-height: 260px;
  min-width: 210px;
  overflow-y: auto;
}
.cluster-choices button {
  justify-content: flex-start;
  text-align: left;
  font-size: 13px;
}
/* OSM's original colours remain unchanged so road/building labels stay legible. */
@media (min-width: 1900px) and (min-aspect-ratio: 2/1) {
  #app header {
    padding: 10px 24px;
    gap: 22px;
  }
  #app .brand {
    font-size: 25px;
  }
  #app .brand-frame,
  #app .brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
  #app .counter {
    padding: 8px 16px;
  }
  #app .counter b {
    font-size: 24px;
  }
  #app .counter span,
  #toggleObjects,
  #mapMenu summary {
    font-size: 18px;
  }
  #app .map-tools button,
  #app .map-tools span {
    font-size: 18px;
  }
  #app .map-legend {
    font-size: 16px;
  }
  #app .object-panel {
    width: 420px;
  }
  #app .object-card strong {
    font-size: 20px;
  }
  #app .object-card p {
    font-size: 16px;
  }
}
@media (max-width: 900px) {
  #app header {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 6px 12px;
  }
  #app .counters {
    order: 4;
    width: 100%;
  }
  #app .counter {
    flex: 1;
    padding: 6px 8px;
  }
  #app .counter span {
    font-size: 11px;
  }
  #app .counter b {
    font-size: 16px;
  }
  #app .header-actions {
    width: auto;
  }
  #app .map-legend {
    font-size: 10px;
    padding: 6px 8px;
    bottom: 66px;
  }
  #app .healthbar.stale {
    left: 12px;
    right: 12px;
    bottom: 26px;
  }
}
@media (max-width: 420px) {
  #app .counter {
    flex-direction: column;
    gap: 0;
    min-height: 42px;
    padding: 4px 6px;
  }
  #app .counter span {
    font-size: 9px;
  }
}
