/* Atlas desktop: taskbar, full-viewport globe, floating windows. */

.map-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  height: 32px;
  min-height: 32px;
  padding: 0 0.55rem;
  flex-wrap: nowrap;
}
.map-header .header-actions {
  margin-left: 0;
  justify-content: flex-end;
  min-width: 0;
}
.taskbar-left,
.taskbar-center,
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.taskbar-center { justify-content: center; }
.taskbar-brand-wrap { position: relative; flex: 0 0 auto; }
.taskbar-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--atlas-text);
  font-family: var(--atlas-font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}
.taskbar-brand:focus-visible,
.taskbar-win:focus-visible,
.taskbar-launcher-item:focus-visible,
.atlas-window-controls button:focus-visible {
  outline: 1px solid var(--atlas-text);
  outline-offset: 2px;
}
.taskbar-windows {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  overflow: auto;
}
.taskbar-win,
.taskbar-launcher-item,
#taskbar-workspace-select {
  appearance: none;
  border: 1px solid var(--atlas-border);
  background: transparent;
  color: var(--atlas-muted);
  font-family: var(--atlas-font-body);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.42rem;
  cursor: pointer;
  line-height: 1.2;
}
.taskbar-win.is-active {
  color: var(--atlas-bg);
  background: var(--atlas-accent);
  border-color: var(--atlas-accent);
}
.taskbar-win.is-min { opacity: 0.55; }
.taskbar-asof {
  color: var(--atlas-muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.taskbar-launcher {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 14rem;
  max-height: min(70vh, 28rem);
  overflow: auto;
  background: var(--atlas-panel);
  border: 1px solid var(--atlas-border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 0.25rem 0;
}
.taskbar-launcher[hidden] { display: none !important; }
.taskbar-launcher-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.7rem;
}
.taskbar-launcher-item:hover { color: var(--atlas-text); background: var(--atlas-hover); }
.taskbar-launcher-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  color: var(--atlas-muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: none;
  border-top: 1px solid var(--atlas-border);
}
#taskbar-workspace-select { text-transform: none; letter-spacing: 0.04em; color: var(--atlas-text); }

.desktop {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--atlas-map-bg);
}
.desktop > #map {
  position: absolute;
  inset: 0;
}
.desktop-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
#desktop-stage { display: none; }

.atlas-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background: var(--atlas-window);
  color: var(--atlas-text);
  border: 1px solid var(--atlas-border);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.atlas-window[hidden] { display: none !important; }
.atlas-window-title {
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.2rem 0 0.55rem;
  background: var(--atlas-window-title);
  border-bottom: 1px solid var(--atlas-border);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.atlas-window.is-focused {
  border-color: var(--atlas-text);
}
.atlas-window.is-focused .atlas-window-title { background: var(--atlas-window-title-focus); }
.atlas-window-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--atlas-font-display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.atlas-window-controls { display: flex; flex: 0 0 auto; }
.atlas-window-controls button {
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: var(--atlas-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}
.atlas-window-controls button:hover { color: var(--atlas-text); }
.atlas-window-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: var(--atlas-window);
}
.atlas-resize { position: absolute; z-index: 2; }
.atlas-resize-n, .atlas-resize-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.atlas-resize-e, .atlas-resize-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.atlas-resize-n { top: 0; }
.atlas-resize-s { bottom: 0; }
.atlas-resize-e { right: 0; }
.atlas-resize-w { left: 0; }
.atlas-resize-ne, .atlas-resize-nw, .atlas-resize-se, .atlas-resize-sw { width: 10px; height: 10px; }
.atlas-resize-ne { top: 0; right: 0; cursor: nesw-resize; }
.atlas-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.atlas-resize-se { bottom: 0; right: 0; cursor: nwse-resize; }
.atlas-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }

.atlas-window[data-app="readout"] .atlas-window-body {
  padding: 0.25rem 0.45rem 0.3rem;
  gap: 0.12rem;
}
.atlas-window[data-app="readout"] .feed-age,
.atlas-window[data-app="readout"] .map-coords {
  font-size: 0.62rem;
  line-height: 1.25;
}
.atlas-window[data-app="readout"] .map-coords,
.atlas-window[data-app="readout"] .feed-age {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
  max-width: none;
  border: 0;
  background: transparent;
  padding: 0;
  pointer-events: none;
}
.atlas-window[data-app="readout"] .map-coords.is-visible,
.atlas-window[data-app="readout"] .feed-age:not([hidden]) {
  display: block;
}

.atlas-window .event-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}
.atlas-window .event-detail {
  flex: 1 1 auto;
  max-height: none;
  visibility: visible;
  padding: 0.9rem 1rem 1.25rem;
}
.atlas-window .nearby-roster { max-height: 42%; background: transparent; }
.atlas-window .source-filters {
  border: 0;
  background: transparent;
}
.atlas-window[data-app="sources"] .source-dropdown-toggle { display: none; }
.atlas-window[data-app="sources"] .source-dropdown-menu {
  display: block;
  position: static;
  max-height: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.atlas-window .source-live {
  margin-left: auto;
  color: var(--atlas-muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.atlas-window #network,
.atlas-window #events-panel,
.atlas-window #stats-page,
.atlas-window #drawings-page {
  display: flex !important;
  flex-direction: column;
  position: absolute;
  inset: 0;
  min-height: 0;
  background: transparent;
}
.atlas-window #network { display: block !important; }
.atlas-window .network-modes { display: block; }
.atlas-window .network-status { z-index: 2; }
.layers-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--atlas-border);
}
.atlas-window[data-app="layers"] #control-toggle { display: none; }
.atlas-window[data-app="layers"] #customize-menu { display: block; }
.atlas-window[data-app="layers"] #customize-panel {
  display: block;
  position: static;
  min-width: 0;
  max-height: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.65rem;
  height: 100%;
}
.timeline-controls input[type="range"] { flex: 1 1 auto; min-width: 4rem; accent-color: var(--atlas-accent); }
.timeline-controls .place-jump { display: flex; align-items: center; gap: 0.35rem; margin: 0; }
.alerts-signin {
  margin: 0;
  padding: 0.75rem 0.85rem;
  color: var(--atlas-muted);
  font-size: 0.8rem;
}
.atlas-window[data-app="alerts"]:has(#alerts-box:not([hidden])) .alerts-signin { display: none; }
.atlas-window[data-app="alerts"] #alerts-box-toggle { display: none; }
.atlas-window[data-app="alerts"] #alerts-box { display: block; }
.atlas-window[data-app="alerts"] #alerts-box-panel {
  display: block;
  position: static;
  min-width: 0;
  max-height: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.map-settings { padding: 0.7rem; gap: 0.7rem; }
.map-settings-types,
.map-settings-overlays,
.layers-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.map-settings-overlays label,
.map-settings-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--atlas-text);
  font-size: 0.75rem;
}
.map-settings-date input[type="range"] { flex: 1 1 auto; }

.atlas-window[data-app="terminal"] .atlas-window-body {
  overflow: hidden;
  background: var(--atlas-window);
  color: var(--atlas-text);
}
.atlas-terminal {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}
.atlas-terminal-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 0.85rem 0.3rem;
}
.atlas-terminal-row { white-space: pre-wrap; word-break: break-word; }
.atlas-terminal-row.is-dim { color: var(--atlas-muted); }
.atlas-terminal-row.is-gap { height: 0.55rem; }
.atlas-terminal-row.is-cmd::before {
  content: "atlas> ";
  color: var(--atlas-muted);
}
.atlas-terminal-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.85rem 0.7rem;
}
.atlas-terminal-prompt { color: var(--atlas-muted); }
.atlas-terminal-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  outline: none;
  caret-color: var(--atlas-text);
}
.show-on-map-fab,
.show-on-network-fab { display: none !important; }
.control-bar { display: none !important; }

/* Each window is one column of panes. Panes scroll inside their own box. */
.atlas-window[data-app="events"] .atlas-window-body,
.atlas-window[data-app="inspector"] .atlas-window-body,
.atlas-window[data-app="table"] .atlas-window-body,
.atlas-window[data-app="stats"] .atlas-window-body,
.atlas-window[data-app="network"] .atlas-window-body {
  overflow: hidden;
  container-type: inline-size;
  container-name: atlas-win;
}
.atlas-window .event-media-filters,
.atlas-window .source-filters,
.atlas-window .network-modes,
.atlas-window .stats-toolbar,
.atlas-window .drawings-toolbar,
.atlas-window .events-toolbar {
  padding: 0.2rem 0.35rem;
  gap: 0.2rem;
}
.atlas-window .event-media-filters .label,
.atlas-window .network-modes .label,
.atlas-window .source-filters .label {
  display: none;
}
.atlas-window .source-chip {
  padding: 0.12rem 0.35rem;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
}
.atlas-window .event-list .small {
  margin: 0;
  padding: 0.15rem 0.4rem !important;
  font-size: 0.6rem;
}
.atlas-window .event-list-item {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  column-gap: 0.4rem;
  align-items: baseline;
  padding: 0.12rem 0.4rem;
  line-height: 1.25;
}
.atlas-window .event-list-item .etype {
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}
.atlas-window .event-list-item .esum {
  margin: 0;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  -webkit-line-clamp: unset;
}
.atlas-window .event-list-item .emeta {
  margin: 0;
  font-size: 0.58rem;
  white-space: nowrap;
}
.atlas-window .event-detail { padding: 0.4rem 0.5rem 0.55rem; }
.atlas-window .event-detail h2 { margin-bottom: 0.2rem; font-size: 0.78rem; }
.atlas-window .obs-item { padding: 0.22rem 0; font-size: 0.7rem; }
.atlas-window .confidence-primary { margin-bottom: 0.35rem; }
.atlas-window .confidence-value { font-size: 0.85rem; }
.atlas-window .source-option { padding: 0.18rem 0.45rem 0.18rem 1.4rem; font-size: 0.7rem; gap: 0.35rem; }
.atlas-window .source-category-toggle { padding: 0.15rem 0.2rem; font-size: 0.7rem; }
.atlas-window .nearby-roster { flex: 0 1 auto; max-height: 34%; overflow: auto; }
.atlas-window .nearby-head { padding: 0.35rem 0.55rem 0.25rem; }
.atlas-window .nearby-notes { padding: 0.25rem 0.55rem 0.4rem; }
.atlas-window .detail-media { margin: 0.45rem 0 0.55rem; gap: 0.35rem; }
.atlas-window .detail-media img,
.atlas-window .detail-media iframe { max-height: 140px; height: auto; }
.atlas-window .detail-media video { max-height: 160px; }

.atlas-window[data-app="inspector"] #detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.atlas-window[data-app="events"] #event-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.atlas-window[data-app="table"] #events-panel {
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.atlas-window[data-app="table"] .events-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}
.atlas-window[data-app="table"] .events-toolbar input[type="search"],
.atlas-window[data-app="table"] .events-toolbar select {
  flex: 1 1 0;
  width: auto;
  max-width: none;
  min-width: 0;
  padding: 0.08rem 0.28rem;
  font-size: 0.65rem;
  line-height: 1.3;
}
.atlas-window[data-app="table"] .btn-clear-filters {
  flex: 0 0 auto;
  padding: 0.08rem 0.3rem;
  font-size: 0.55rem;
  letter-spacing: 0.06em;
}
.atlas-window[data-app="table"] #events-result-count {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.58rem;
  white-space: nowrap;
}
.atlas-window[data-app="table"] .events-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.atlas-window[data-app="table"] .events-table-wrap,
.atlas-window[data-app="table"] .events-live {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.atlas-window[data-app="table"] .events-live {
  display: none;
}
.atlas-window[data-app="table"] .events-live-header,
.atlas-window[data-app="table"] .events-live-item {
  padding: 0.12rem 0.35rem;
}
.atlas-window[data-app="table"] .events-live-item .esum {
  margin: 0;
  font-size: 0.65rem;
  white-space: nowrap;
  display: block;
  -webkit-line-clamp: unset;
}
.atlas-window[data-app="table"] .events-live-item .emeta { margin: 0; font-size: 0.58rem; }
.atlas-window[data-app="table"] .events-table {
  width: 100%;
  table-layout: fixed;
}
.atlas-window[data-app="table"] .col-type { width: 22%; }
.atlas-window[data-app="table"] .col-status { width: 14%; }
.atlas-window[data-app="table"] .col-summary { width: 32%; }
.atlas-window[data-app="table"] .col-time { width: 16%; }
.atlas-window[data-app="table"] .col-conf { width: 9%; }
.atlas-window[data-app="table"] .col-loc { width: 7%; }
.atlas-window[data-app="table"] .events-table {
  font-size: 0.68rem;
}
.atlas-window[data-app="table"] .events-table th,
.atlas-window[data-app="table"] .events-table td {
  padding: 0.1rem 0.35rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.atlas-window[data-app="table"] .events-table .esum {
  max-width: none;
  display: table-cell;
  -webkit-line-clamp: unset;
}
@container atlas-win (max-width: 520px) {
  .atlas-window[data-app="table"] .col-time,
  .atlas-window[data-app="table"] .col-conf,
  .atlas-window[data-app="table"] .col-loc,
  .atlas-window[data-app="table"] .events-table th:nth-child(n + 4),
  .atlas-window[data-app="table"] .events-table td:nth-child(n + 4) {
    display: none;
  }
  .atlas-window[data-app="table"] .col-type { width: 28%; }
  .atlas-window[data-app="table"] .col-status { width: 18%; }
  .atlas-window[data-app="table"] .col-summary { width: 54%; }
}
@container atlas-win (min-width: 560px) {
  .atlas-window[data-app="table"] .events-body {
    grid-template-columns: minmax(0, 1fr) 9.5rem;
  }
  .atlas-window[data-app="table"] .events-live {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--atlas-border);
  }
}

.atlas-window[data-app="stats"] #stats-page {
  overflow: hidden;
}
.atlas-window[data-app="stats"] .stats-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 11rem);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.atlas-window[data-app="stats"] .stats-metrics {
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.4rem;
  padding: 0.45rem;
}
.atlas-window[data-app="stats"] .stats-row { padding: 0.3rem 0.45rem; }
.atlas-window[data-app="stats"] .stats-value { margin-top: 0.1rem; font-size: 0.95rem; }
.atlas-window[data-app="stats"] .stats-meta { margin-top: 0.1rem; }
.atlas-window[data-app="stats"] .stats-watched {
  flex: none;
  max-width: none;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-top: 0.45rem;
  border-left: 1px solid var(--atlas-border);
}
@container atlas-win (max-width: 420px) {
  .atlas-window[data-app="stats"] .stats-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 7.5rem;
  }
  .atlas-window[data-app="stats"] .stats-watched {
    border-left: 0;
    border-top: 1px solid var(--atlas-border);
  }
}

.atlas-window[data-app="network"] .network-modes {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  padding: 0.15rem 0.35rem;
}
.atlas-window[data-app="network"] .network-status {
  font-size: 0.62rem;
  padding: 0.15rem 0.35rem;
}
.atlas-window[data-app="network"] #network {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
.atlas-window[data-app="network"] .network-status {
  left: 8px;
  bottom: 8px;
}

.atlas-window[data-app="layers"] #customize-menu,
.atlas-window[data-app="alerts"] #alerts-box,
.atlas-window[data-app="sources"] .source-filters {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.atlas-window[data-app="layers"] #customize-panel,
.atlas-window[data-app="alerts"] #alerts-box-panel {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  width: auto;
  overflow: auto;
  padding: 0.4rem 0.5rem;
}
.atlas-window[data-app="sources"] .source-dropdown {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.atlas-window[data-app="sources"] .source-dropdown-menu {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.atlas-window[data-app="saved"] .drawings-grid {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.45rem;
  padding: 0.45rem;
}
.atlas-window[data-app="saved"] .drawing-card { padding: 0.55rem 0.65rem; }
.atlas-window[data-app="timeline"] .timeline-controls {
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
}
.atlas-window[data-app="timeline"] .place-jump { flex: 0 1 auto; min-width: 0; }
.atlas-window[data-app="timeline"] .place-jump input { width: 6.5rem; }
.atlas-window[data-app="map-settings"] .map-settings { padding: 0.45rem 0.55rem; gap: 0.45rem; }

@media (max-width: 720px) {
  .map-header { grid-template-columns: minmax(0, 1fr) auto; }
  .taskbar-center { display: none; }
  .header-actions .small { display: none; }
}
