/**
 * Operation Phoenix Phase 2 — Mission Control layout
 * Map-first command shell. Dashboard only.
 */

.phx-mission-body {
  margin: 0;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  background: var(--phx-bg-void);
}

.phx-mission {
  --phx-ribbon-h: 3.25rem;
  --phx-dock-h: calc(var(--phx-touch-min) + var(--phx-space-3) + var(--phx-safe-bottom));
  --phx-ticker-h: 2.125rem;
  --phx-chrome-bottom: calc(var(--phx-dock-h) + var(--phx-ticker-h) + var(--phx-space-3));
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--phx-text-primary);
}

.phx-map-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.phx-map-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.phx-map-container .maplibregl-map {
  width: 100%;
  height: 100%;
}

.phx-map-container .maplibregl-ctrl-top-right {
  top: calc(var(--phx-ribbon-h) + var(--phx-safe-top) + var(--phx-space-3));
  right: calc(var(--phx-space-3) + var(--phx-safe-right));
}

.phx-map-container .maplibregl-ctrl-bottom-right {
  bottom: var(--phx-chrome-bottom);
  right: calc(var(--phx-space-3) + var(--phx-safe-right));
}

.phx-radar-zoom-badge {
  position: absolute;
  left: 0.75rem;
  bottom: calc(0.75rem + var(--phx-safe-bottom, 0px));
  z-index: 6;
  max-width: min(92vw, 34rem);
  padding: 0.4rem 0.65rem;
  border-radius: var(--phx-radius-sm, 4px);
  border: 1px solid var(--phx-glass-border, rgba(255,255,255,0.12));
  background: rgba(12, 18, 24, 0.88);
  backdrop-filter: blur(var(--phx-glass-blur, 6px));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur, 6px));
  color: #e8f0f6;
  font: 600 0.78rem/1.25 system-ui, sans-serif;
  letter-spacing: 0.02em;
  box-shadow: var(--phx-shadow-sm, 0 1px 4px rgba(0,0,0,0.35));
  pointer-events: none;
}

.phx-radar-zoom-badge.hidden {
  display: none;
}

.phx-map-quick {
  position: absolute;
  left: calc(var(--phx-space-3) + var(--phx-safe-left));
  bottom: var(--phx-chrome-bottom);
  z-index: 5;
  display: flex;
  gap: var(--phx-space-2);
}

.phx-map-quick-btn {
  min-height: var(--phx-touch-min);
  min-width: var(--phx-touch-min);
  padding: 0 0.85rem;
  font-family: var(--phx-font-ui);
  font-size: var(--phx-text-sm);
  font-weight: 600;
  color: var(--phx-text-primary);
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  border: 1px solid var(--phx-glass-border);
  border-radius: var(--phx-radius-sm);
  box-shadow: var(--phx-shadow-md);
  cursor: pointer;
}

.phx-map-quick-btn:hover {
  border-color: var(--phx-accent);
}

.phx-map-legend-note {
  position: absolute;
  left: calc(var(--phx-space-3) + var(--phx-safe-left));
  bottom: calc(var(--phx-chrome-bottom) + 2.85rem);
  z-index: 5;
  max-width: 14rem;
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-size: var(--phx-text-xs);
  color: var(--phx-text-secondary);
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  border: 1px solid var(--phx-glass-border);
  border-radius: var(--phx-radius-sm);
  pointer-events: none;
}

.phx-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding-top: var(--phx-safe-top);
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  border-bottom: 1px solid var(--phx-glass-border);
  box-shadow: var(--phx-shadow-md);
}

.phx-ribbon-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--phx-space-3);
  min-height: var(--phx-ribbon-h);
  padding: var(--phx-space-2) var(--phx-space-4);
  padding-left: calc(var(--phx-space-4) + var(--phx-safe-left));
  padding-right: calc(var(--phx-space-4) + var(--phx-safe-right));
}

.phx-ribbon-brand {
  display: flex;
  align-items: center;
  gap: var(--phx-space-3);
  min-width: 0;
  flex: 1;
}

.phx-ribbon-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.phx-ribbon-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--phx-radius-sm);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--phx-border-subtle);
}

.phx-ribbon-logo.is-hidden {
  display: none;
}

.phx-ribbon-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--phx-radius-sm);
  font-family: var(--phx-font-display);
  font-size: var(--phx-text-sm);
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid var(--phx-border-default);
  box-shadow: var(--phx-shadow-sm);
}

.phx-ribbon-initials.hidden {
  display: none;
}

.phx-ribbon-title-row {
  display: flex;
  align-items: center;
  gap: var(--phx-space-2);
  min-width: 0;
  flex-wrap: wrap;
}

.phx-ribbon-mode {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: var(--phx-tracking-wide);
  text-transform: uppercase;
  color: var(--phx-text-primary);
  background: color-mix(in srgb, var(--phx-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--phx-accent) 45%, transparent);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.phx-ribbon-titles {
  min-width: 0;
}

.phx-ribbon-app {
  margin: 0;
  font-size: var(--phx-text-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phx-ribbon-org {
  display: block;
  font-size: var(--phx-text-xs);
  color: var(--phx-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phx-ribbon-actions {
  display: flex;
  align-items: center;
  gap: var(--phx-space-2);
  flex-shrink: 0;
}

.phx-ribbon-settings {
  display: none;
  font-size: var(--phx-text-xs);
  padding: 0 0.55rem;
  min-width: auto;
}

.phx-dock-btn.has-alert {
  border-color: var(--phx-danger-border);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--phx-danger) 25%, transparent);
}

.phx-ribbon-profile-wrap {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.phx-ribbon-profile-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: var(--phx-tracking-wide);
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.phx-dashboard-profile-select {
  min-height: 2rem;
  min-width: 8rem;
  max-width: min(14rem, 32vw);
  padding: 0.2rem 1.6rem 0.2rem 0.55rem;
  font-family: var(--phx-font-ui);
  font-size: var(--phx-text-xs);
  font-weight: 600;
  color: var(--phx-text-primary);
  background: var(--phx-bg-inset);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--phx-text-muted) 50%),
    linear-gradient(135deg, var(--phx-text-muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) calc(50% - 2px), calc(100% - 8px) calc(50% - 2px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.phx-dashboard-profile-select:focus {
  outline: none;
  border-color: var(--phx-accent);
}

.phx-focus-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--phx-space-1);
  padding: 0 var(--phx-space-4) var(--phx-space-2);
  padding-left: calc(var(--phx-space-4) + var(--phx-safe-left));
  padding-right: calc(var(--phx-space-4) + var(--phx-safe-right));
  border-top: 1px solid var(--phx-border-subtle);
}

.phx-focus-strip:empty {
  display: none;
  padding: 0;
  border: none;
}

.phx-focus-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--phx-space-1);
}

.phx-focus-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--phx-text-secondary);
  background: var(--phx-bg-inset);
  border: 1px solid var(--phx-border-subtle);
  border-radius: 999px;
  white-space: nowrap;
}

.phx-mission:has(.phx-focus-strip:not(:empty)) {
  --phx-ribbon-h: 4.35rem;
}

.phx-mission:has(.phx-focus-strip:not(:empty)):has(.phx-ribbon-threat:not(.hidden)) {
  --phx-ribbon-h: 6.6rem;
}

.phx-ribbon-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: var(--phx-tracking-wide);
  text-transform: uppercase;
  color: var(--phx-highlight, var(--phx-success));
  background: color-mix(in srgb, var(--phx-highlight, var(--phx-success)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--phx-highlight, var(--phx-success)) 35%, transparent);
  border-radius: 999px;
}

.phx-ribbon-badge.hidden {
  display: none;
}

@media (min-width: 768px) {
  .phx-ribbon-profile-wrap {
    display: flex;
  }

  .phx-ribbon-badge {
    display: inline-flex;
  }

  .phx-ribbon-settings {
    display: inline-flex;
  }

  .ow2-status-bar {
    display: flex;
  }
}

.phx-ribbon-icon-btn {
  min-width: var(--phx-touch-min);
  min-height: var(--phx-touch-min);
  padding: 0;
  font-family: var(--phx-font-ui);
  font-size: var(--phx-text-sm);
  font-weight: 700;
  color: var(--phx-text-primary);
  background: var(--phx-bg-inset);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  cursor: pointer;
}

.phx-ribbon-icon-btn:hover,
.phx-ribbon-icon-btn[aria-expanded="true"] {
  border-color: var(--phx-accent);
  color: var(--phx-accent);
}

.phx-ribbon-refresh {
  font-size: 1.15rem;
  line-height: 1;
}

.phx-ribbon-threat {
  margin: 0;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--phx-border-subtle);
  box-shadow: none;
  padding: var(--phx-space-2) var(--phx-space-4);
  padding-left: calc(var(--phx-space-4) + var(--phx-safe-left));
  padding-right: calc(var(--phx-space-4) + var(--phx-safe-right));
}

.phx-ribbon-threat.hidden {
  display: none;
}

.phx-mission:has(.phx-ribbon-threat:not(.hidden)) {
  --phx-ribbon-h: 5.5rem;
}

.phx-context {
  position: fixed;
  top: calc(var(--phx-ribbon-h) + var(--phx-safe-top));
  left: calc(var(--phx-space-3) + var(--phx-safe-left));
  right: calc(var(--phx-space-3) + var(--phx-safe-right));
  z-index: 190;
  max-width: 28rem;
}

.phx-context[hidden] {
  display: none;
}

.phx-context-inner {
  margin: 0;
  padding: var(--phx-space-3);
  box-shadow: var(--phx-shadow-lg);
}

.phx-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--phx-space-2) var(--phx-space-4);
  margin: var(--phx-space-2) 0 0;
  font-size: var(--phx-text-xs);
  color: var(--phx-text-muted);
}

.phx-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(5, 8, 12, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--phx-motion-base) var(--phx-ease-out);
}

.phx-panel-backdrop.is-visible {
  opacity: 1;
}

.phx-panel-backdrop[hidden] {
  display: none;
}

.phx-panel {
  position: fixed;
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  border: 1px solid var(--phx-glass-border);
  box-shadow: var(--phx-shadow-lg);
  overflow: hidden;
}

.phx-panel[hidden] {
  display: none;
}

.phx-panel.is-open {
  display: flex;
}

.phx-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--phx-space-3);
  padding: var(--phx-space-3) var(--phx-space-4);
  border-bottom: 1px solid var(--phx-border-subtle);
  flex-shrink: 0;
}

.phx-panel-title {
  margin: 0;
  font-family: var(--phx-font-display);
  font-size: var(--phx-text-md);
  font-weight: 600;
}

.phx-panel-close {
  min-width: var(--phx-touch-min);
  min-height: var(--phx-touch-min);
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--phx-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--phx-radius-sm);
  cursor: pointer;
}

.phx-panel-close:hover {
  color: var(--phx-text-primary);
  background: var(--phx-bg-inset);
}

.phx-panel-body {
  padding: var(--phx-space-4);
  flex: 1;
  min-height: 0;
}

.phx-panel-body-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.phx-panel-section {
  margin-bottom: var(--phx-space-4);
}

.phx-panel-section-title {
  margin: 0 0 var(--phx-space-2);
  font-size: var(--phx-text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--phx-tracking-wide);
  color: var(--phx-text-muted);
}

.phx-module-grid {
  display: flex;
  flex-direction: column;
  grid-template-columns: 1fr !important;
  gap: var(--phx-space-3);
  margin-bottom: var(--phx-space-4);
}

.phx-health-in-panel {
  margin-top: var(--phx-space-2);
}

.phx-locations-list {
  max-height: none;
}

.phx-layer-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--phx-space-2);
}

.phx-layer-chip {
  width: 100%;
  justify-content: flex-start;
  min-height: var(--phx-touch-min);
  align-items: flex-start;
  gap: var(--phx-space-2);
}

.phx-layer-chip-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.phx-layer-chip-title {
  font-weight: 600;
  color: var(--phx-text-primary);
}

.phx-layer-chip-status {
  font-size: 0.72rem;
  color: var(--phx-text-muted);
  line-height: 1.25;
}

.phx-layer-chip[data-health="ok"] .phx-layer-chip-status { color: var(--phx-success, #3ecf8e); }
.phx-layer-chip[data-health="empty"] .phx-layer-chip-status { color: var(--phx-warning, #e6b84d); }
.phx-layer-chip[data-health="error"] .phx-layer-chip-status { color: var(--phx-danger, #ef6b6b); }
.phx-layer-chip[data-health="pending"] .phx-layer-chip-status { color: var(--phx-text-muted); }

.incident-log-unmapped {
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--phx-warning-border, rgba(230, 184, 77, 0.35));
  border-radius: var(--phx-radius-md, 8px);
  background: var(--phx-warning-bg, rgba(230, 184, 77, 0.08));
}
.incident-log-unmapped-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  color: var(--phx-warning, #e6b84d);
}
.incident-log-unmapped-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--phx-text-secondary);
}
.incident-log-unmapped-list li { margin: 0.35rem 0; }


.phx-map-diag {
  margin-top: var(--phx-space-3);
  border-top: 1px solid var(--phx-border-default);
  padding-top: var(--phx-space-2);
  font-size: 0.75rem;
}

.phx-map-diag-body {
  margin: 0.5rem 0 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--phx-font-data, ui-monospace, Consolas, monospace);
  font-size: 0.68rem;
  color: var(--phx-text-secondary);
  background: var(--phx-bg-inset);
}

.ow2-status--btn {
  cursor: pointer;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: var(--phx-tracking-wide);
  text-transform: uppercase;
}
.ow2-status--btn:hover,
.ow2-status--btn[aria-expanded="true"] {
  filter: brightness(1.08);
  outline: 1px solid currentColor;
}
.phx-status-diag {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0.5rem;
  z-index: 80;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(60vh, 28rem);
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-md, 8px);
  background: var(--phx-bg-elevated, var(--phx-bg-panel, #12161c));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  color: var(--phx-text-primary);
}
.phx-ribbon-actions {
  position: relative;
}
.phx-status-diag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.phx-status-diag-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
}
.phx-status-diag-body {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--phx-text-secondary);
}
.phx-status-diag-body dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
}
.phx-status-diag-body dt {
  color: var(--phx-text-muted);
  font-weight: 600;
}
.phx-status-diag-body dd {
  margin: 0;
}
.phx-status-diag-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}
.phx-status-diag-list li { margin: 0.2rem 0; }
  padding: 0.5rem;
  border-radius: var(--phx-radius-sm);
}

.phx-more-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--phx-space-2);
  margin-bottom: var(--phx-space-4);
}

.phx-more-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--phx-touch-min);
  padding: 0 var(--phx-space-4);
  font-size: var(--phx-text-sm);
  font-weight: 600;
  color: var(--phx-accent);
  text-decoration: none;
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-bg-inset);
}

.phx-more-link:hover {
  border-color: var(--phx-accent);
}

@media (orientation: landscape), (min-width: 768px) {
  .phx-panel {
    top: calc(var(--phx-ribbon-h) + var(--phx-safe-top) + var(--phx-space-2));
    right: calc(var(--phx-safe-right) + var(--phx-space-2));
    bottom: calc(var(--phx-dock-h) + var(--phx-space-2));
    width: min(400px, 42vw);
    border-radius: var(--phx-radius-lg);
    transform: translateX(calc(100% + var(--phx-space-4)));
    transition: transform var(--phx-motion-base) var(--phx-ease-out);
  }

  .phx-panel.is-open {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phx-panel {
    transition: none !important;
  }
}

@media (orientation: portrait) and (max-width: 767px) {
  .phx-panel {
    top: auto;
    left: calc(var(--phx-safe-left) + var(--phx-space-2));
    right: calc(var(--phx-safe-right) + var(--phx-space-2));
    bottom: calc(var(--phx-dock-h) + var(--phx-space-2));
    max-height: min(58vh, 520px);
    border-radius: var(--phx-radius-lg) var(--phx-radius-lg) 0 0;
    transform: translateY(110%);
    transition: transform var(--phx-motion-base) var(--phx-ease-out);
  }

  .phx-panel.is-open {
    transform: translateY(0);
  }

  .phx-ribbon-badge {
    display: inline-flex;
  }
}

.phx-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
  padding: var(--phx-space-2) var(--phx-space-2) calc(var(--phx-space-2) + var(--phx-safe-bottom));
  padding-left: calc(var(--phx-space-2) + var(--phx-safe-left));
  padding-right: calc(var(--phx-space-2) + var(--phx-safe-right));
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  border-top: 1px solid var(--phx-glass-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

.phx-dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--phx-touch-min);
  max-width: 6.5rem;
  padding: var(--phx-space-1) var(--phx-space-2);
  font-family: var(--phx-font-ui);
  font-size: var(--phx-text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--phx-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--phx-radius-sm);
  cursor: pointer;
  transition:
    color var(--phx-motion-fast) var(--phx-ease-out),
    background var(--phx-motion-fast) var(--phx-ease-out),
    border-color var(--phx-motion-fast) var(--phx-ease-out),
    transform var(--phx-motion-fast) var(--phx-ease-out);
  -webkit-tap-highlight-color: transparent;
}

.phx-dock-btn::before {
  content: "";
  display: block;
  width: var(--phx-icon-md);
  height: var(--phx-icon-md);
  background: currentColor;
  opacity: 0.75;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: opacity var(--phx-motion-fast) var(--phx-ease-out);
}

.phx-dock-btn[data-dock="map"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolygon points='1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6'/%3E%3Cline x1='8' y1='2' x2='8' y2='18'/%3E%3Cline x1='16' y1='6' x2='16' y2='22'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolygon points='1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6'/%3E%3Cline x1='8' y1='2' x2='8' y2='18'/%3E%3Cline x1='16' y1='6' x2='16' y2='22'/%3E%3C/svg%3E");
}

.phx-dock-btn[data-dock="brief"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='8' y1='13' x2='16' y2='13'/%3E%3Cline x1='8' y1='17' x2='13' y2='17'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='8' y1='13' x2='16' y2='13'/%3E%3Cline x1='8' y1='17' x2='13' y2='17'/%3E%3C/svg%3E");
}

.phx-dock-btn[data-dock="intel"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}

.phx-dock-btn[data-dock="locations"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}

.phx-dock-btn[data-dock="layers"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E");
}

.phx-dock-btn[data-dock="more"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/svg%3E");
}

.phx-dock-btn:active:not(.is-active) {
  transform: scale(0.96);
}

.phx-dock-btn.is-active::before {
  opacity: 1;
}

.phx-dock-btn:hover {
  color: var(--phx-text-primary);
  background: var(--phx-bg-inset);
}

.phx-dock-btn.is-active {
  color: var(--phx-accent);
  border-color: var(--phx-info-border);
  background: var(--phx-info-bg);
}

.phx-dock-label {
  white-space: nowrap;
}

.phx-status-footer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--phx-dock-h) + var(--phx-ticker-h) + var(--phx-space-1));
  z-index: 50;
  pointer-events: none;
  max-width: 90%;
  padding: 0 var(--phx-space-3);
  font-size: var(--phx-text-xs);
  color: var(--phx-text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 768px) {
  .phx-status-footer {
    display: none;
  }
}

/* ── Operation Phoenix Phase 3 — Command Center intelligence ── */

.intel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.5rem;
  padding: var(--phx-space-4);
}

.intel-loading-text {
  font-size: var(--phx-text-sm);
  font-weight: 600;
  color: var(--phx-text-muted);
  letter-spacing: 0.02em;
}

.intel-empty {
  margin: 0;
  padding: var(--phx-space-4) var(--phx-space-3);
  font-size: var(--phx-text-sm);
  font-weight: 500;
  color: var(--phx-text-muted);
  text-align: center;
  border: 1px dashed var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-bg-inset);
}

.intel-row {
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-glass-bg);
  overflow: hidden;
  box-shadow: var(--phx-shadow-sm);
}

.intel-row.threat-band-green,
.intel-row.threat-band-blue,
.intel-row.threat-band-yellow,
.intel-row.threat-band-orange,
.intel-row.threat-band-red,
.intel-row.threat-band-black {
  border-left-width: 3px;
}

.intel-row-header {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: var(--phx-space-3);
  padding-right: 2rem;
  border: none;
  background: transparent;
  color: var(--phx-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.intel-row-header:disabled {
  cursor: default;
}

.intel-row-header:not(:disabled):active {
  background: var(--phx-bg-inset);
}

.intel-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--phx-space-2);
  margin-bottom: var(--phx-space-1);
}

.intel-row-title {
  flex: 1;
  min-width: 0;
  font-size: var(--phx-text-sm);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.intel-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-xs);
  white-space: nowrap;
}

.intel-chip.intel-chip--live {
  background: var(--phx-success-bg);
  border-color: var(--phx-success-border);
  color: var(--phx-success);
}

.intel-chip.intel-chip--warn {
  background: var(--phx-warning-bg);
  border-color: var(--phx-warning-border);
  color: var(--phx-warning);
}

.intel-chip.intel-chip--danger {
  background: var(--phx-danger-bg);
  border-color: var(--phx-danger-border);
  color: var(--phx-danger);
}

.intel-chip.intel-chip--offline,
.intel-chip.intel-chip--neutral {
  background: var(--phx-neutral-bg);
  border-color: var(--phx-neutral-border);
  color: var(--phx-text-muted);
}

.intel-row-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
  line-height: 1.1;
}

.intel-metric-value {
  font-family: var(--phx-font-display);
  font-size: var(--phx-text-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.intel-metric-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--phx-text-muted);
}

.intel-row-headline {
  margin: 0 0 var(--phx-space-2);
  font-size: var(--phx-text-base);
  font-weight: 600;
  line-height: 1.35;
  color: var(--phx-text-primary);
}

.intel-row-line {
  margin: 0 0 var(--phx-space-1);
  font-size: var(--phx-text-sm);
  line-height: 1.4;
  color: var(--phx-text-secondary);
}

.intel-row-line:last-of-type {
  margin-bottom: 0;
}

.intel-label {
  display: inline-block;
  min-width: 4.25rem;
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.intel-row-action {
  color: var(--phx-accent);
  font-weight: 600;
}

.intel-row-chevron {
  position: absolute;
  right: var(--phx-space-3);
  top: var(--phx-space-3);
  font-size: 0.75rem;
  color: var(--phx-text-muted);
  transition: transform var(--phx-motion-fast) var(--phx-ease-out);
}

.intel-row.is-expanded .intel-row-chevron {
  transform: rotate(180deg);
}

.intel-row-detail {
  padding: 0 var(--phx-space-3) var(--phx-space-3);
  border-top: 1px solid var(--phx-border-subtle);
  font-size: var(--phx-text-sm);
  color: var(--phx-text-secondary);
}

.intel-row-detail[hidden] {
  display: none;
}

.intel-detail-list {
  margin: var(--phx-space-2) 0 0;
  padding-left: 1.1rem;
}

.intel-detail-list li {
  margin-bottom: 0.25rem;
}

.intel-detail-note {
  margin: var(--phx-space-2) 0 0;
  font-size: var(--phx-text-sm);
  color: var(--phx-text-muted);
}

/* Command brief (Alfred) */
.cmd-brief {
  display: flex;
  flex-direction: column;
  gap: var(--phx-space-4);
}

.cmd-brief-posture {
  display: flex;
  align-items: center;
  gap: var(--phx-space-3);
  padding: var(--phx-space-3);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
}

.cmd-brief-score {
  font-family: var(--phx-font-display);
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cmd-brief-posture-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cmd-brief-band {
  font-size: var(--phx-text-sm);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.cmd-brief-label {
  font-size: var(--phx-text-sm);
  color: var(--phx-text-secondary);
}

.cmd-brief-heading {
  margin: 0 0 var(--phx-space-2);
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.cmd-brief-text {
  margin: 0;
  font-size: var(--phx-text-base);
  font-weight: 600;
  line-height: 1.45;
}

.cmd-brief-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: var(--phx-text-sm);
  line-height: 1.45;
}

.cmd-brief-list li {
  margin-bottom: 0.35rem;
}

.cmd-brief-checks li {
  font-weight: 600;
  color: var(--phx-accent);
}

.cmd-brief-warn {
  margin: 0;
  padding: var(--phx-space-2) var(--phx-space-3);
  font-size: var(--phx-text-xs);
  color: var(--phx-warning);
  background: var(--phx-warning-bg);
  border: 1px solid var(--phx-warning-border);
  border-radius: var(--phx-radius-xs);
}

/* Saved locations — operator panel */
.loc-op-row {
  padding: var(--phx-space-3);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-bg-inset);
}

.loc-op-name {
  margin: 0 0 var(--phx-space-1);
  font-size: var(--phx-text-base);
}

.loc-op-label {
  margin: 0 0 var(--phx-space-2);
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.loc-op-coords {
  margin: 0;
  font-family: var(--phx-font-mono, monospace);
  font-size: var(--phx-text-sm);
  font-variant-numeric: tabular-nums;
}

.loc-op-meta {
  margin: var(--phx-space-1) 0 0;
  font-size: var(--phx-text-sm);
  color: var(--phx-text-muted);
}

.loc-op-summary {
  margin: 0 0 var(--phx-space-3);
  padding: var(--phx-space-2) var(--phx-space-3);
  font-size: var(--phx-text-sm);
  font-weight: 600;
  color: var(--phx-text-secondary);
  background: var(--phx-bg-inset);
  border-radius: var(--phx-radius-xs);
}

.loc-op-item {
  display: flex;
  flex-direction: column;
  gap: var(--phx-space-1);
  padding: var(--phx-space-3);
  margin-bottom: var(--phx-space-2);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-glass-bg);
  min-height: var(--phx-touch-min);
}

.loc-op-item.is-disabled {
  opacity: 0.55;
}

.loc-op-item.needs-attention {
  border-left: 3px solid var(--phx-warning);
}

.loc-op-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--phx-space-2);
}

.loc-op-item-name {
  font-size: var(--phx-text-base);
}

.loc-op-item-type {
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.loc-op-item-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--phx-space-2);
}

.phx-ribbon-refresh.is-spinning {
  animation: phx-spin-once 0.6s var(--phx-ease-out);
}

@keyframes phx-spin-once {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .phx-ribbon-refresh.is-spinning {
    animation: none;
  }

  .phx-dock-btn:active:not(.is-active) {
    transform: none;
  }
}

/* ── Phase 2 command overlays ── */
.phx-op-hud,
.phx-exec-brief-inline,
.phx-op-detail {
  position: fixed;
  z-index: 150;
  top: var(--phx-overlay-top, calc(var(--phx-ribbon-h) + var(--phx-safe-top) + var(--phx-space-2)));
  bottom: var(--phx-overlay-bottom, var(--phx-chrome-bottom));
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--phx-glass-border);
  border-radius: var(--phx-radius-md);
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  box-shadow: var(--phx-shadow-lg);
}

.phx-op-hud,
.phx-exec-brief-inline {
  left: calc(var(--phx-space-2) + var(--phx-safe-left));
  width: min(20rem, calc(100vw - var(--phx-safe-left) - var(--phx-safe-right) - 1.5rem));
  max-width: 28vw;
}

.phx-op-detail {
  right: calc(var(--phx-space-2) + var(--phx-safe-right));
  left: auto;
  width: min(18rem, calc(100vw - var(--phx-safe-left) - var(--phx-safe-right) - 22rem));
  max-width: min(18rem, 26vw);
}

.phx-inline-title {
  margin: 0;
  padding: var(--phx-space-2) var(--phx-space-3);
  border-bottom: 1px solid var(--phx-border-subtle);
  font-size: var(--phx-text-xs);
  font-weight: 700;
  letter-spacing: var(--phx-tracking-wide);
  text-transform: uppercase;
  color: var(--phx-text-muted);
}

.phx-hud-section {
  margin-bottom: var(--phx-space-2);
}

.phx-hud-heading {
  margin: 0 0 var(--phx-space-1);
  font-size: var(--phx-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--phx-tracking-wide);
  color: var(--phx-text-muted);
}

.phx-hud-lead {
  margin: 0;
  font-size: var(--phx-text-sm);
  line-height: 1.35;
}

.phx-hud-action,
.phx-hud-muted {
  margin: var(--phx-space-1) 0 0;
  font-size: var(--phx-text-xs);
  color: var(--phx-text-secondary);
}

.phx-hud-posture {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--phx-radius-sm);
  font-size: var(--phx-text-xs);
  font-weight: 700;
}

.phx-hud-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--phx-space-2);
  margin-bottom: var(--phx-space-3);
}

.phx-hud-metric {
  padding: var(--phx-space-2) var(--phx-space-2);
  border: 1px solid var(--phx-border-subtle);
  border-radius: var(--phx-radius-sm);
  background: color-mix(in srgb, var(--phx-bg-inset) 88%, transparent);
}

.phx-hud-metric--alert {
  border-color: var(--phx-danger, #ef4444);
}

.phx-hud-metric-value {
  display: block;
  font-size: var(--phx-text-md);
  font-weight: 700;
  line-height: 1.2;
}

.phx-hud-metric-label {
  display: block;
  font-size: var(--phx-text-xs);
  text-transform: uppercase;
  letter-spacing: var(--phx-tracking-wide);
  color: var(--phx-text-muted);
}

.phx-hud-metric-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--phx-text-xs);
  color: var(--phx-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phx-overlay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--phx-space-1);
}

.phx-overlay-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-height: var(--phx-touch-min);
  padding: 0.35rem 0.55rem;
  font-family: var(--phx-font-ui);
  font-size: var(--phx-text-xs);
  color: var(--phx-text-primary);
  background: var(--phx-bg-inset);
  border: 1px solid var(--phx-border-default);
  border-radius: var(--phx-radius-sm);
  cursor: pointer;
}

.phx-overlay-chip.phx-chip--live {
  border-color: var(--phx-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--phx-accent) 25%, transparent);
}

.phx-overlay-chip.phx-chip--off {
  opacity: 0.65;
}

.phx-chip-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--phx-tracking-wide);
}

.phx-chip-value {
  color: var(--phx-text-secondary);
}

.phx-inline-body {
  padding: var(--phx-space-3);
  padding-bottom: calc(var(--phx-space-4) + var(--phx-space-2));
  font-size: var(--phx-text-sm);
  line-height: 1.4;
}

.phx-inline-list {
  margin: 0;
  padding-left: 1rem;
}

.phx-inline-list li {
  margin-bottom: 0.25rem;
}

.phx-inline-kv {
  margin: 0 0 var(--phx-space-1);
}

.phx-intel-ticker {
  position: fixed;
  left: calc(var(--phx-space-2) + var(--phx-safe-left));
  right: calc(var(--phx-space-2) + var(--phx-safe-right));
  bottom: calc(var(--phx-dock-h) + var(--phx-space-1));
  z-index: 60;
  min-height: var(--phx-ticker-h);
  border: 1px solid var(--phx-glass-border);
  border-radius: var(--phx-radius-sm);
  background: var(--phx-glass-bg-strong);
  backdrop-filter: blur(var(--phx-glass-blur));
  -webkit-backdrop-filter: blur(var(--phx-glass-blur));
  box-shadow: var(--phx-shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.phx-intel-ticker-track {
  white-space: nowrap;
  will-change: transform;
  padding-left: 100%;
  animation: phx-ticker 28s linear infinite;
  font-size: var(--phx-text-sm);
  color: var(--phx-text-secondary);
}

@keyframes phx-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (orientation: portrait) and (max-width: 767px) {
  .ow2-header-meta {
    display: none;
  }

  .ow2-status-bar .ow2-status:not(#status-live_intelligence) {
    display: none;
  }

  .phx-ribbon-profile-wrap {
    display: flex;
    max-width: 7.5rem;
  }

  .phx-dashboard-profile-select {
    max-width: 7.5rem;
  }

  .phx-ribbon-mode {
    display: none;
  }

  .phx-op-hud,
  .phx-exec-brief-inline,
  .phx-op-detail {
    width: auto;
    left: calc(var(--phx-space-2) + var(--phx-safe-left));
    right: calc(var(--phx-space-2) + var(--phx-safe-right));
    max-width: none;
    max-height: none;
  }

  .phx-op-detail {
    top: auto;
    bottom: var(--phx-overlay-bottom, calc(var(--phx-chrome-bottom) + 0.5rem));
    max-height: min(22vh, 14rem);
  }

  .phx-op-hud,
  .phx-exec-brief-inline {
    top: var(--phx-overlay-top, calc(var(--phx-ribbon-h) + var(--phx-safe-top) + var(--phx-space-1)));
    bottom: auto;
    max-height: min(24vh, 16rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phx-intel-ticker-track {
    animation: none;
    padding-left: 0.75rem;
  }
}
