:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-elevated: #1e293b;
  --border-color: #334155;
  --border-light: #475569;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-green: #22c55e;
  --accent-orange: #f97316;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;
  
  --panel-width: 320px;
  --topbar-height: 58px;
  --timeline-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* App Layout Grid */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Top Navigation Bar */
#top-bar {
  min-height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
  position: relative;
  overflow: visible;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #0284c7, #22c55e);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: white;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #fff;
  line-height: 1.2;
}

.brand-title span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* App Sub-Menu Bar (File, Tools, View, Reports, Help) */
.app-menu-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  z-index: 120;
}

.menu-item {
  position: relative;
}

.menu-trigger-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  user-select: none;
}

.menu-trigger-btn:hover,
.menu-item.open .menu-trigger-btn {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  color: #38bdf8;
}

.menu-trigger-btn svg {
  width: 10px;
  height: 10px;
  opacity: 0.7;
}

/* Dropdown Sub-Menus */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  background: #1e293b;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  animation: menuFadeIn 0.12s ease-out;
}

@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-item.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  transition: background 0.1s ease;
  user-select: none;
}

.dropdown-item:hover {
  background: #0284c7;
  color: #fff;
}

.dropdown-icon {
  font-size: 14px;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-label {
  flex: 1;
  white-space: nowrap;
}

.dropdown-shortcut {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: monospace;
  margin-left: 12px;
  font-weight: 600;
}

.dropdown-item:hover .dropdown-shortcut {
  color: rgba(255, 255, 255, 0.85);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 6px;
}

/* Active Tool Toolbar */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-primary);
  padding: 3px 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-tertiary);
  color: #fff;
}

.tool-btn.active {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.4);
}

.tool-btn svg {
  width: 16px;
  height: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #475569;
  border-color: #64748b;
}

.action-btn.primary {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
}

.action-btn.primary:hover {
  background: #1d4ed8;
}

.action-btn.accent {
  background: #16a34a;
  border-color: #22c55e;
  color: #fff;
}

.action-btn.accent:hover {
  background: #15803d;
}

/* Main Workspace */
#workspace {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Left Sidebar - Overlays & Layers */
#layers-sidebar {
  width: var(--panel-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow-y: auto;
  flex-shrink: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

#layers-sidebar.collapsed {
  margin-left: calc(-1 * var(--panel-width));
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
}

/* Sidebar Expand Floating Tab on Map Viewport */
.sidebar-expand-tab {
  position: absolute;
  top: 14px;
  left: 0;
  z-index: 45;
  background: #1e293b;
  border: 1px solid var(--border-light);
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  display: none;
  align-items: center;
  gap: 6px;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
  user-select: none;
}

.sidebar-expand-tab:hover {
  background: #334155;
  color: #fff;
  padding-left: 15px;
}

#layers-sidebar.collapsed ~ #map-viewport-wrapper .sidebar-expand-tab {
  display: flex;
}

#layer-groups-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.layer-group {
  border-bottom: 1px solid var(--border-color);
  padding: 10px 14px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.12s ease;
  position: relative;
  background: transparent;
}

.layer-group.dragging {
  opacity: 0.35;
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px dashed #38bdf8 !important;
  border-radius: 6px;
  transform: scale(0.98);
}

.layer-group.drag-over-top {
  border-top: 3px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.05);
}

.layer-group.drag-over-bottom {
  border-bottom: 3px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.05);
}

.layer-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  padding: 3px 4px;
  border-radius: 4px;
  transition: background 0.1s ease;
}

.layer-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.group-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 18px;
  color: var(--text-muted);
  cursor: grab;
  font-size: 13px;
  line-height: 1;
  margin-right: 2px;
  opacity: 0.45;
  transition: opacity 0.15s, color 0.15s, transform 0.1s;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.group-drag-handle:hover,
.layer-group-header:hover .group-drag-handle {
  opacity: 1;
  color: #38bdf8;
}

.group-drag-handle:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.group-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 8px;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

.layer-group.collapsed .layer-group-content {
  display: none !important;
}

.layer-group.collapsed .layer-group-header {
  margin-bottom: 0;
}

/* Touch drag floating badge on iPad / iPhone */
.touch-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 12px rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  user-select: none;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 4px;
}

.layer-item:hover {
  color: #fff;
}

.layer-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.layer-checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-primary);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-checkbox:checked {
  background: #0284c7;
  border-color: #38bdf8;
}

.layer-checkbox:checked::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: bold;
}

.layer-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Layer Style Swatches */
.swatch-line {
  width: 24px;
  height: 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.swatch-line.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0, currentColor 5px, transparent 5px, transparent 9px) !important;
  height: 4px;
}

.swatch-line.dotted {
  background: repeating-linear-gradient(90deg, currentColor 0, currentColor 3px, transparent 3px, transparent 6px) !important;
  height: 4px;
}

.swatch-line.dash-dot {
  background: repeating-linear-gradient(90deg, currentColor 0, currentColor 6px, transparent 6px, transparent 9px, currentColor 9px, currentColor 11px, transparent 11px, transparent 14px) !important;
  height: 4px;
}

.inline-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.inline-action-btn:hover {
  background: var(--bg-tertiary);
  color: #fff;
}

.inline-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.inline-action-btn.primary:hover {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
}

.swatch-box {
  width: 20px;
  height: 20px;
  border: 2px solid #dc2626;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  flex-shrink: 0;
}

.swatch-circle {
  width: 20px;
  height: 20px;
  border: 2px solid #dc2626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  flex-shrink: 0;
}

.swatch-tag {
  background: #ffffff;
  color: #dc2626;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid #dc2626;
}

.swatch-marker {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.swatch-marker.circle {
  border-radius: 50%;
}

.swatch-marker.square {
  border-radius: 2px;
}

.swatch-marker.diamond {
  transform: rotate(45deg);
  border-radius: 2px;
}

.swatch-marker.diamond > span {
  transform: rotate(-45deg);
}

.swatch-marker.triangle {
  width: 0;
  height: 0;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-bottom: 16px solid currentColor !important;
  border-top: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Canvas Viewport */
#map-viewport-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #090d16;
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

#map-viewport-wrapper.panning {
  cursor: grabbing;
}

#map-viewport-wrapper.crosshair {
  cursor: crosshair;
}

#map-canvas, #overlay-svg, #crop-canvas, #assembly-canvas, .drone-lightbox-image-container {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

#map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

#overlay-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#overlay-svg * {
  pointer-events: auto;
}

/* Sticky Notes on Map */
.sticky-note-card {
  position: absolute;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  z-index: 15;
  color: #1e293b;
  cursor: move;
  transition: box-shadow 0.2s;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.sticky-note-card:hover {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}

.sticky-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
  border-bottom: 1px dashed rgba(0,0,0,0.2);
  padding-bottom: 4px;
}

.sticky-note-body {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  font-size: 12px;
  font-family: inherit;
  color: inherit;
  line-height: 1.4;
  outline: none;
}

.sticky-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  opacity: 0.65;
  margin-top: 6px;
}

.sticky-resize-handle {
  width: 14px;
  height: 14px;
  position: absolute;
  bottom: 2px;
  right: 2px;
  cursor: se-resize;
  opacity: 0.5;
}

/* Drone Photo Pins */
.drone-pin {
  cursor: pointer;
}

.drone-pin circle {
  transition: r 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), fill 0.18s ease, stroke 0.18s ease, filter 0.18s ease;
}

.drone-pin:hover circle {
  r: 23;
  fill: #0ea5e9;
  stroke: #ffffff;
  stroke-width: 3px;
  filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.7));
}

.drone-pin text {
  transition: font-size 0.18s ease;
  user-select: none;
  pointer-events: none;
}

.drone-pin:hover text:first-of-type {
  font-size: 19px;
}

/* Right Tool & Detail Drawer */
#inspector-drawer {
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

#inspector-drawer.collapsed {
  transform: translateX(100%);
  position: absolute;
  right: 0;
}

.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.drawer-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

/* Viewport Controls HUD */
.map-hud-controls {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
}

.hud-btn-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hud-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.hud-btn:hover {
  background: var(--bg-tertiary);
}

.hud-btn + .hud-btn {
  border-top: 1px solid var(--border-color);
}

.hud-scale-display {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  text-align: center;
  font-weight: 600;
}

/* Minimap Navigator */
#minimap-container {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 180px;
  height: 120px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 25;
}

#minimap-canvas {
  width: 100%;
  height: 100%;
}

#minimap-box {
  position: absolute;
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  pointer-events: none;
}

/* Bottom Progress & Timeline Bar */
#timeline-bar {
  height: var(--timeline-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 30;
  gap: 16px;
}

.timeline-mode-toggle {
  display: flex;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--bg-tertiary);
  color: #fff;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 600px;
}

.timeline-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.timeline-slider {
  flex: 1;
  accent-color: #0284c7;
  cursor: pointer;
}

.timeline-date-display {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 130px;
  text-align: center;
}

.metrics-summary-chips {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-chip {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.metric-chip span.label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.metric-chip span.value {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Stitching Studio Tabs & Canvas */
.stitch-tab-nav {
  display: flex;
  gap: 8px;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.stitch-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.stitch-tab-btn:hover {
  color: #fff;
  background: var(--bg-tertiary);
}

.stitch-tab-btn.active {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.4);
}

.stitch-tab-pane {
  display: none;
  height: calc(100% - 55px);
}

.stitch-tab-pane.active {
  display: block;
}

#stitch-preview-canvas, #stitch-crop-canvas {
  width: 100%;
  height: 100%;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: block;
}

.stitch-page-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.stitch-page-card:hover {
  border-color: #64748b;
}

.stitch-page-card.selected {
  border-color: #38bdf8;
  background: rgba(2, 132, 199, 0.15);
}

/* Lightbox / Drone Photo Viewer */
.drone-lightbox-image-container {
  position: relative;
  width: 100%;
  height: 480px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}

.drone-lightbox-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #38bdf8;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  border: 1px solid #475569;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================== TABLET & IPAD RESPONSIVE OPTIMIZATION ================== */
@media (max-width: 1024px) {
  :root {
    --panel-width: 280px;
    --topbar-height: 52px;
  }

  .menu-trigger-btn {
    min-height: 38px;
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .tool-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-height: 36px;
  }

  .action-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
  }

  .modal-window {
    width: 95vw !important;
    max-height: 92vh !important;
  }
}

@media (max-width: 900px) {
  .brand-title span {
    display: none;
  }

  .toolbar-actions .tool-btn span {
    display: none;
  }

  .toolbar-actions .tool-btn {
    padding: 8px 10px;
  }
}

/* Touch Device Target Sizes (Apple HIG minimum tap targets for field use) */
@media (pointer: coarse) {
  .menu-trigger-btn {
    min-height: 40px;
    padding: 8px 12px;
  }

  .dropdown-item {
    padding: 10px 14px;
    font-size: 13.5px;
  }

  .dropdown-menu {
    min-width: 280px;
  }

  .tool-btn {
    min-height: 40px;
    padding: 8px 12px;
  }

  .action-btn {
    min-height: 40px;
    padding: 8px 14px;
  }

  .map-hud-btn {
    width: 38px;
    height: 38px;
  }

  .layer-item {
    padding: 8px 6px;
  }

  .sticky-resize-handle {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
}

/* ================== MOBILE & IPHONE RESPONSIVE OPTIMIZATION ================== */
.mobile-only {
  display: none !important;
}

.mobile-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex !important;
  }

  /* Support for iPhone Notch, Dynamic Island, and Home Indicator (Safe Areas) */
  #top-bar {
    padding-top: max(8px, env(safe-area-inset-top, 8px));
    padding-left: max(10px, env(safe-area-inset-left, 10px));
    padding-right: max(10px, env(safe-area-inset-right, 10px));
    padding-bottom: 6px;
    flex-wrap: wrap;
    min-height: auto;
    gap: 8px 6px;
  }

  /* Compact Brand on Phone */
  .brand-section {
    gap: 6px;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
    font-size: 15px;
    border-radius: 6px;
  }

  .brand-title h1 {
    font-size: 13px;
    line-height: 1.1;
  }

  .brand-title span {
    display: none !important;
  }

  /* Compact App Menu Bar */
  .app-menu-bar {
    gap: 2px;
  }

  .menu-trigger-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-height: 36px;
  }

  .menu-trigger-btn svg {
    display: none;
  }

  /* Dropdown Menus positioned cleanly on mobile */
  .dropdown-menu {
    position: fixed !important;
    top: 56px !important;
    left: 8px !important;
    right: 8px !important;
    width: calc(100vw - 16px) !important;
    max-width: 360px !important;
    max-height: 75vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1050;
  }

  /* Top Bar Right Buttons on Mobile */
  .topbar-right {
    gap: 6px;
    margin-left: auto;
  }

  .topbar-right .action-btn {
    padding: 6px 10px;
    font-size: 11.5px;
    min-height: 36px;
  }

  /* Horizontal Thumb-Scrollable Tool Ribbon for iPhone */
  #tool-bar.toolbar-actions {
    width: 100%;
    order: 10;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 5px 2px;
    margin: 2px 0 0 0;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    gap: 6px;
  }

  #tool-bar.toolbar-actions::-webkit-scrollbar {
    display: none;
  }

  #tool-bar .tool-btn {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 38px;
    padding: 6px 11px;
    font-size: 11.5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
  }

  #tool-bar .tool-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #fff;
  }

  #tool-bar .tool-btn span {
    display: inline !important;
  }

  /* Full-bleed Canvas Workspace */
  #workspace {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  #map-viewport-wrapper {
    width: 100% !important;
    height: 100% !important;
    flex: 1;
  }

  /* Mobile Slide-Out Layers Sidebar */
  #layers-sidebar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    width: min(320px, 86vw) !important;
    max-width: 86vw !important;
    z-index: 60 !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    pointer-events: none;
    margin-left: 0 !important;
    opacity: 1 !important;
  }

  #layers-sidebar.mobile-open {
    transform: translateX(0) !important;
    pointer-events: auto !important;
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.75) !important;
  }

  /* Mobile Slide-Out Inspector Drawer */
  #inspector-drawer {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    width: min(320px, 86vw) !important;
    max-width: 86vw !important;
    z-index: 60 !important;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    pointer-events: none;
    margin-right: 0 !important;
    opacity: 1 !important;
  }

  #inspector-drawer.mobile-open {
    transform: translateX(0) !important;
    pointer-events: auto !important;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.75) !important;
  }

  /* Mobile HUD Buttons (Ergonomic thumb reach) */
  .map-hud-controls {
    bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 0px)));
    right: max(12px, calc(12px + env(safe-area-inset-right, 0px)));
    z-index: 30;
  }

  .hud-btn {
    width: 40px;
    height: 40px;
  }

  /* Minimap on Mobile */
  #minimap-container {
    bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 0px)));
    left: max(10px, env(safe-area-inset-left, 0px));
    width: 120px;
    height: 70px;
    z-index: 25;
  }

  /* Mobile Modals */
  .modal-window {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    margin: auto !important;
    border-radius: 10px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 14px !important;
    max-height: calc(90vh - 105px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 10px 16px;
  }

  /* Responsive Grids in Modals */
  .modal-body div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables inside modals should scroll horizontally without breaking modal width */
  #crews-table-container,
  #cov-table-container,
  #saved-projects-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Small Screen Phones (iPhone SE, iPhone Mini <= 420px) */
@media (max-width: 420px) {
  .menu-trigger-btn {
    padding: 5px 6px;
    font-size: 11px;
  }

  #btn-projects-modal span {
    display: none;
  }

  #btn-export-project span {
    display: none;
  }

  .topbar-right .action-btn {
    padding: 6px 8px;
  }

  #btn-mobile-layers span, #btn-mobile-inspector span {
    display: inline !important;
  }
}

/* ========================================================
   Company Profiles & Standards Studio Styling
   ======================================================== */
.profile-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.profile-card:hover {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.75);
}

.profile-card.active-profile {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.15);
}

.profile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.profile-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-badge-active {
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-badge-code {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.profile-badge-tag {
  background: rgba(147, 51, 234, 0.2);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.35);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}

.profile-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.profile-elements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 14px;
}

.profile-element-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-element-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.profile-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.profile-swatch-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-secondary);
}

.profile-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 2px;
}

.profile-actions-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .profile-elements-grid {
    grid-template-columns: 1fr !important;
  }
  .profile-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .profile-actions-bar {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================
   HOVER MODE (AUTO-HIDE / PEEK SENSORS) STYLING
   ============================================================ */

/* View Menu Toggle Badges & Section Header */
.dropdown-section-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-blue);
  padding: 6px 10px 2px 10px;
  user-select: none;
}

.dropdown-toggle-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: all 0.15s ease;
  margin-left: auto;
}

.dropdown-toggle-badge.active {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.25);
}

.dropdown-item:hover .dropdown-toggle-badge {
  border-color: rgba(255, 255, 255, 0.6);
}

/* Hover Sensor Edge Zones */
.hover-sensor {
  position: absolute;
  z-index: 85;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.hover-sensor-top {
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 101;
  cursor: pointer;
}

.hover-mode-topbar .hover-sensor-top {
  display: flex;
}

.hover-sensor-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: 14px;
  display: none;
  justify-content: center;
  align-items: flex-end;
  z-index: 96;
  cursor: pointer;
}

.hover-mode-bottombar .hover-sensor-bottom {
  display: flex;
}

.hover-sensor-left {
  top: 70px;
  bottom: 70px;
  left: 0;
  width: 14px;
  display: none;
  align-items: center;
  justify-content: flex-start;
  z-index: 92;
  cursor: pointer;
}

.hover-mode-sidebar .hover-sensor-left {
  display: flex;
}

/* Hover Peek Floating Pills */
.hover-peek-pill {
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  letter-spacing: 0.2px;
}

.hover-peek-pill:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.75), 0 0 16px rgba(56, 189, 248, 0.5);
  transform: scale(1.04);
}

.peek-pill-top {
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 5px 16px;
}

.peek-pill-bottom {
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 5px 16px;
}

.peek-pill-left {
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 14px 6px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* Cleanly hide peek pills when respective bars are revealed */
.topbar-revealed .peek-pill-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
}

.bottombar-revealed .peek-pill-bottom {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
}

.sidebar-revealed .peek-pill-left {
  opacity: 0;
  pointer-events: none;
  transform: rotate(180deg) translateX(100%);
}

/* --- 1. Top Bar in Hover Mode --- */
.hover-mode-topbar #top-bar {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 100 !important;
  transform: translateY(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  box-shadow: none;
}

.hover-mode-topbar #top-bar:hover,
.hover-mode-topbar #top-bar:focus-within,
.hover-mode-topbar #top-bar.menu-open,
.hover-mode-topbar #top-bar.hover-revealed,
.topbar-revealed #top-bar {
  transform: translateY(0) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
}

/* --- 2. Bottom Timeline Bar in Hover Mode --- */
.hover-mode-bottombar #timeline-bar {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 95 !important;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  box-shadow: none;
}

.hover-mode-bottombar #timeline-bar:hover,
.hover-mode-bottombar #timeline-bar:focus-within,
.hover-mode-bottombar #timeline-bar.hover-revealed,
.bottombar-revealed #timeline-bar {
  transform: translateY(0) !important;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8) !important;
}

/* --- 3. Overlays & Layers Sidebar in Hover Mode --- */
.hover-mode-sidebar #layers-sidebar {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 90 !important;
  height: 100% !important;
  width: var(--panel-width) !important;
  max-width: 88vw !important;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  box-shadow: none;
  opacity: 1 !important;
  pointer-events: auto !important;
  margin-left: 0 !important;
}

.hover-mode-sidebar #layers-sidebar:hover,
.hover-mode-sidebar #layers-sidebar:focus-within,
.hover-mode-sidebar #layers-sidebar.hover-revealed,
.sidebar-revealed #layers-sidebar {
  transform: translateX(0) !important;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.8) !important;
}

.hover-mode-sidebar .sidebar-expand-tab {
  display: none !important;
}

/* Touch device ergonomic sizing */
@media (pointer: coarse) {
  .hover-peek-pill {
    padding: 8px 18px;
    font-size: 12.5px;
  }
  .peek-pill-left {
    padding: 18px 8px;
  }
}

/* ============================================================
   LIVE COLLABORATION, IDENTITY & AUDIT STREAM STYLING
   ============================================================ */

/* Topbar User Identity Button */
.user-identity-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
}

.user-identity-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #38bdf8;
}

.user-avatar-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  flex-shrink: 0;
}

.user-display-crew-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  letter-spacing: 0.3px;
}

/* Sync Status Wrapper & Live Pill */
.sync-status-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sync-status-pill:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.sync-dot.live {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseSync 2s infinite;
}

.sync-dot.connecting {
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
  animation: pulseSync 1s infinite;
}

.sync-dot.offline {
  background: #94a3b8;
  box-shadow: none;
}

@keyframes pulseSync {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Sync Users Dropdown */
.sync-users-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 250px;
  background: #1e293b;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: menuFadeIn 0.15s ease-out;
}

.sync-status-wrapper:hover .sync-users-dropdown,
.sync-status-wrapper.open .sync-users-dropdown {
  display: flex;
}

.sync-dropdown-header {
  padding: 8px 12px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-color);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Activity Stream Card Styling */
.activity-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.12s ease;
}

.activity-card:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(56, 189, 248, 0.4);
}

.activity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.activity-card-user {
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-card-time {
  color: var(--text-muted);
  font-size: 10.5px;
}

.activity-card-desc {
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 500;
}

.activity-card-crew-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
