/* ============================================
   SS MALIK // Global Execution Network
   Real-Time Map Interface
   ============================================ */

:root {
  --bg: #020408;
  --bg-panel: rgba(2, 4, 8, 0.95);
  --cyan: #4ce6ff;
  --cyan-dim: rgba(76, 230, 255, 0.4);
  --cyan-glow: rgba(76, 230, 255, 0.15);
  --red: #ff4757;
  --red-dim: rgba(255, 71, 87, 0.5);
  --red-glow: rgba(255, 71, 87, 0.15);
  --amber: #ffb703;
  --ink: #dfe9f0;
  --ink-dim: #8ea2af;
  --line: rgba(76, 230, 255, 0.18);
  --mono: 'IBM Plex Mono', monospace;
  --display: 'Orbitron', sans-serif;
  --sidebar-w: 360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   BOOT SEQUENCE
   ============================================ */
.boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.boot-screen.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-log {
  width: min(640px, 90vw);
  font-size: 0.78rem;
  line-height: 2.2;
  white-space: pre-wrap;
  color: var(--cyan-dim);
}
.boot-log .ok { color: #5cf2a1; }
.boot-log .warn { color: var(--amber); }

/* ============================================
   ATMOSPHERE OVERLAYS
   ============================================ */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.012) 0px,
    rgba(255,255,255,0.012) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(2,4,8,0.7) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 350;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 250;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(76,230,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(76,230,255,0.03) 0%, transparent 50%);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 260;
  background-image:
    linear-gradient(rgba(76,230,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76,230,255,0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.6;
}

/* ============================================
   LEAFLET MAP
   ============================================ */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--bg);
}

/* Standard OpenStreetMap tiles are light by default (no free dark tile source
   is reliably key-free at all zooms), so invert + re-tint them to reproduce
   the original dark cyan map look. Applied to the tile pane itself so it
   covers every tile as it loads in, not just the ones present at init. */
#map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.92) saturate(0.6);
}

#map .leaflet-control-attribution {
  background: rgba(2,4,8,0.85) !important;
  color: var(--ink-dim) !important;
  font-family: var(--mono) !important;
  font-size: 0.6rem !important;
  border-top-left-radius: 6px;
  backdrop-filter: blur(8px);
}
#map .leaflet-control-attribution a {
  color: var(--cyan-dim) !important;
}

#map .leaflet-control-zoom {
  display: none !important;
}

/* ============================================
   CUSTOM MARKERS
   ============================================ */
.map-marker-hq {
  position: relative;
  width: 20px;
  height: 20px;
}
.map-marker-hq .marker-core {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow:
    0 0 0 4px rgba(76,230,255,0.2),
    0 0 20px var(--cyan),
    0 0 40px rgba(76,230,255,0.3);
  animation: pulse-blue 2.2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
.map-marker-hq .marker-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  opacity: 0.6;
  animation: ripple-out 3s ease-out infinite;
  pointer-events: none;
}

.map-marker-service {
  position: relative;
  width: 14px;
  height: 14px;
}
.map-marker-service .marker-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow:
    0 0 0 3px rgba(255,71,87,0.15),
    0 0 14px var(--red),
    0 0 28px rgba(255,71,87,0.25);
  animation: pulse-red 2.8s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
.map-marker-service .marker-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--red);
  opacity: 0.5;
  animation: ripple-out 3.5s ease-out infinite;
  animation-delay: 0.5s;
  pointer-events: none;
}

@keyframes pulse-blue {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.85; }
}

@keyframes pulse-red {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.8; }
}

@keyframes ripple-out {
  0% { width: 100%; height: 100%; opacity: 0.6; }
  100% { width: 70px; height: 70px; opacity: 0; margin: -35px 0 0 -35px; }
}

/* Marker labels */
.marker-label {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 1px 2px rgba(0,0,0,0.9);
  background: rgba(2,4,8,0.75);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid rgba(76,230,255,0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.leaflet-marker-icon:hover .marker-label,
.marker-label.visible {
  opacity: 1;
}

/* ============================================
   ZOOM CONTROLS
   ============================================ */
.zoom-controls {
  position: fixed;
  bottom: 100px;
  left: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.zoom-btn {
  width: 44px;
  height: 44px;
  background: rgba(2, 4, 8, 0.9);
  border: 1px solid var(--line);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.zoom-btn:hover {
  background: rgba(76,230,255,0.1);
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(76,230,255,0.15);
}
.zoom-btn:active { transform: scale(0.92); }

.zoom-level {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  margin-top: 4px;
  background: rgba(2,4,8,0.9);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* ============================================
   INFO CARD
   ============================================ */
#info-card {
  position: fixed;
  z-index: 500;
  background: rgba(2, 4, 8, 0.97);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: min(420px, 92vw);
  backdrop-filter: blur(24px);
  box-shadow: 0 0 60px rgba(0,0,0,0.9), 0 0 20px rgba(76,230,255,0.08);
  transition: opacity 0.35s ease, transform 0.35s ease;
  overflow: hidden;
}
#info-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96) translateY(8px);
}

.info-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.info-close:hover { color: var(--ink); background: rgba(255,255,255,0.05); }

.info-header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.info-badge {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 10px;
  font-family: var(--mono);
}
.info-badge.hq {
  background: rgba(76,230,255,0.12);
  color: var(--cyan);
  border: 1px solid rgba(76,230,255,0.25);
}
.info-badge.service {
  background: rgba(255,71,87,0.12);
  color: var(--red);
  border: 1px solid rgba(255,71,87,0.25);
}

#info-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.info-body {
  padding: 18px 24px 20px;
  max-height: 45vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.info-body::-webkit-scrollbar { width: 4px; }
.info-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.service-item {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(76,230,255,0.06);
}
.service-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.service-item h4 {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 6px;
  font-weight: 600;
}
.service-item p {
  font-size: 0.78rem;
  color: var(--ink-dim);
  line-height: 1.65;
}

.info-actions {
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-zoom-btn,
.info-download-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
  text-align: center;
}
.info-zoom-btn:hover {
  background: rgba(76,230,255,0.08);
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(76,230,255,0.1);
}
.info-download-btn {
  color: var(--amber);
  border-color: rgba(255,183,3,0.2);
}
.info-download-btn:hover {
  background: rgba(255,183,3,0.08);
  border-color: var(--amber);
  box-shadow: 0 0 15px rgba(255,183,3,0.1);
}

/* ============================================
   SIDEBAR
   ============================================ */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-panel);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--line);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-header h2 {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.sidebar-header .accent { color: var(--cyan); margin-right: 4px; }

#sidebar-close {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}
#sidebar-close:hover { color: var(--ink); background: rgba(255,255,255,0.05); }

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(76,230,255,0.08);
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 14px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}
.sidebar-search input::placeholder { color: var(--ink-dim); }
.sidebar-search input:focus { border-color: var(--cyan-dim); }

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar-content::-webkit-scrollbar { width: 5px; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.sidebar-section {
  margin-bottom: 18px;
}
.sidebar-section-title {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-left: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.sidebar-section-title.hq-title::before { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.sidebar-section-title.service-title::before { background: var(--red); box-shadow: 0 0 6px var(--red); }

.sidebar-node {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.sidebar-node:hover {
  background: rgba(76,230,255,0.04);
  border-color: rgba(76,230,255,0.12);
}
.sidebar-node.active {
  background: rgba(76,230,255,0.06);
  border-color: rgba(76,230,255,0.2);
}

.node-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.node-dot.hq { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.node-dot.service { background: var(--red); box-shadow: 0 0 8px var(--red); }

.node-info { flex: 1; min-width: 0; }
.node-name {
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-services {
  font-size: 0.62rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(2,4,8,0.5);
}
.live-pulse {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5cf2a1;
  box-shadow: 0 0 8px #5cf2a1;
  animation: pulse-green 2s ease-in-out infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.node-count {
  font-size: 0.6rem;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.sidebar-download {
  width: 100%;
  padding: 8px;
  background: rgba(255,183,3,0.06);
  border: 1px solid rgba(255,183,3,0.2);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
  text-align: center;
}
.sidebar-download:hover {
  background: rgba(255,183,3,0.12);
  border-color: var(--amber);
  box-shadow: 0 0 12px rgba(255,183,3,0.1);
}

/* ============================================
   MOBILE SIDEBAR TOGGLE
   ============================================ */
#sidebar-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 150;
  width: 44px;
  height: 44px;
  background: rgba(2, 4, 8, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s;
}
#sidebar-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--cyan);
  border-radius: 1px;
  transition: all 0.3s ease;
}
#sidebar-toggle:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(76,230,255,0.1);
}
#sidebar-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#sidebar-toggle.active span:nth-child(2) { opacity: 0; }
#sidebar-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ============================================
   CONTACT BAR
   ============================================ */
#contact-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: var(--sidebar-w);
  z-index: 90;
  background: rgba(2, 4, 8, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 0;
}

.contact-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  max-width: 100%;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-brand {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-mark {
  color: var(--cyan);
  margin-right: 3px;
}
.contact-brand .divider {
  color: var(--ink-dim);
  margin: 0 8px;
  font-weight: 400;
}

.contact-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-email {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  text-decoration: none;
  letter-spacing: 0.04em;
  border-bottom: 1px dotted rgba(76,230,255,0.3);
  transition: all 0.2s;
  padding-bottom: 1px;
}
.contact-email:hover {
  color: var(--ink);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 10px rgba(76,230,255,0.3);
}
.contact-divider {
  color: var(--ink-dim);
  font-size: 0.65rem;
}

.contact-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.65rem;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.contact-meta .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5cf2a1;
  box-shadow: 0 0 8px #5cf2a1;
  animation: pulse-green 2s ease-in-out infinite;
}
.clock {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink-dim);
  min-width: 60px;
  text-align: right;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 769px) {
  #sidebar {
    transform: translateX(0) !important;
  }
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 300px; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 85vw; }

  #sidebar {
    transform: translateX(100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }

  #contact-bar {
    right: 0;
  }

  .contact-inner {
    padding: 10px 16px;
    gap: 8px;
  }
  .contact-brand {
    font-size: 0.7rem;
  }
  .contact-email {
    font-size: 0.65rem;
  }
  .contact-meta {
    font-size: 0.6rem;
    gap: 6px;
  }
  .contact-meta .status-text {
    display: none;
  }

  .zoom-controls {
    bottom: 90px;
    left: 12px;
  }
  .zoom-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  #info-card {
    left: 50% !important;
    top: auto !important;
    bottom: 90px;
    transform: translateX(-50%) scale(1);
    max-width: 94vw;
  }
  #info-card.hidden {
    transform: translateX(-50%) scale(0.96) translateY(8px);
  }
}

@media (max-width: 480px) {
  .contact-brand .divider,
  .contact-brand span:not(.brand-mark) {
    display: none;
  }
  .contact-brand::after {
    content: 'SS MALIK';
    font-family: var(--display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink);
  }
  .contact-brand {
    font-size: 0;
  }
  .contact-brand .brand-mark {
    font-size: 0.7rem;
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* AI Floating Mascot Widget Styles */
#ai-mascot-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 9999;
  font-family: Arial, sans-serif;
}

#ai-mascot-btn {
  font-size: 32px;
  background: #ff6b6b;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

#ai-mascot-btn:hover {
  transform: scale(1.1);
}

#ai-chat-box {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 320px;
  height: 420px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #eee;
}

#ai-chat-box.hidden {
  display: none;
}

.chat-header {
  background: #ff6b6b;
  color: white;
  padding: 12px 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

#chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.msg.user {
  align-self: flex-end;
  background: #0070f3;
  color: white;
}

.msg.assistant {
  align-self: flex-start;
  background: #f1f3f5;
  color: #333;
}

#chat-form {
  display: flex;
  padding: 10px;
  border-top: 1px solid #eee;
  gap: 6px;
}

#chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
}

#chat-form button {
  background: #0070f3;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}


/* =========================================================
   SS MALIK TOOL HUB — additive only
   The original map, typography and panels are retained.
   ========================================================= */
#ssToolHub{
  position:fixed;
  top:16px;
  right:18px;
  z-index:10050;
  width:72px;
  height:72px;
  font-family:var(--mono);
  user-select:none;
  touch-action:none;
}
#ssToolLogo{
  width:64px;height:64px;padding:0;border-radius:50%;
  border:1px solid rgba(76,230,255,.55);
  background:rgba(2,4,8,.90);
  overflow:hidden;display:flex;align-items:center;justify-content:center;
  cursor:grab;
  box-shadow:0 0 0 3px rgba(76,230,255,.08),0 0 28px rgba(76,230,255,.25),0 8px 22px rgba(0,0,0,.55);
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
  -webkit-tap-highlight-color:transparent;
}
#ssToolLogo:active{cursor:grabbing}
#ssToolLogo:hover{transform:scale(1.04);border-color:var(--cyan);box-shadow:0 0 0 4px rgba(76,230,255,.12),0 0 34px rgba(76,230,255,.38),0 8px 24px rgba(0,0,0,.65)}
#ssToolLogo img{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.ss-tool-menu{
  position:absolute;top:76px;right:0;width:268px;max-width:calc(100vw - 24px);
  padding:8px;background:rgba(2,4,8,.96);border:1px solid var(--line);
  border-radius:12px;box-shadow:-12px 18px 44px rgba(0,0,0,.58),0 0 30px rgba(76,230,255,.07);
  backdrop-filter:blur(18px);
}
.ss-tool-menu[aria-hidden="true"]{display:none}
.ss-tool-menu-title{
  padding:8px 10px 10px;color:var(--cyan);font-family:var(--display);
  font-size:.65rem;letter-spacing:.12em;border-bottom:1px solid var(--line);margin-bottom:4px;
}
.ss-tool-item{
  width:100%;display:flex;align-items:center;gap:10px;padding:11px 12px;
  border:0;background:transparent;color:var(--ink);text-decoration:none;
  font:500 .72rem var(--mono);letter-spacing:.07em;border-radius:7px;cursor:pointer;text-align:left;
}
.ss-tool-item:hover,.ss-tool-item:focus-visible{background:rgba(76,230,255,.09);color:var(--cyan);outline:none}
.ss-tool-item span{width:20px;text-align:center;color:var(--cyan);font-size:.9rem}
.ss-tool-item b{margin-left:auto;color:var(--ink-dim);font-size:1rem}
.ss-edit-submenu{padding:4px 0 4px 8px;border-top:1px solid rgba(76,230,255,.10);margin-top:3px}
.ss-edit-submenu[hidden]{display:none}
.ss-edit-submenu .ss-tool-item{font-size:.66rem;padding:9px 10px}

/* The original NETWORK NODES sidebar is still used as the Worklist, but is
   deliberately hidden until WORKLIST is selected. */
#sidebar{transform:translateX(100%) !important}
#sidebar.open{transform:translateX(0) !important}
#sidebar-toggle{display:none !important}
#sidebar-close{display:flex !important}

/* Make the logo/menu safe on every screen size. */
@media(max-width:768px){
  #ssToolHub{top:10px;right:10px;width:62px;height:62px}
  #ssToolLogo{width:56px;height:56px}
  .ss-tool-menu{top:66px;right:0;width:min(286px,calc(100vw - 18px))}
}
@media(prefers-reduced-motion:reduce){
  #ssToolLogo{transition:none}
}
/* Draggable AI mascot — additive enhancement; chat box remains in its original style. */
#ai-mascot-container{touch-action:none}
#ai-mascot-btn{cursor:grab;user-select:none;touch-action:none}
#ai-mascot-btn:active{cursor:grabbing}
#ai-mascot-container.ss-mascot-dragging #ai-chat-box{pointer-events:none}
