* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  overflow: hidden;
}

.sasi-topbar {
  height: 58px;
  background: linear-gradient(135deg, #091e3a 0%, #0f3460 100%);
  color: #fff;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  position: relative;
  z-index: 1050;
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(14,165,233,0.4);
}
.brand-title { font-weight: 800; font-size: 16px; letter-spacing: 0.3px; line-height: 1.1; }
.brand-sub { font-weight: 500; color: #7dd3fc; font-size: 13px; }
.brand-desc { font-size: 11px; color: #cbd5e1; }

.stat-pill {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #e2e8f0;
}

.sasi-workspace {
  display: flex;
  height: calc(100vh - 58px);
  width: 100%;
  position: relative;
}

.sasi-sidebar {
  width: 430px;
  min-width: 360px;
  max-width: 100%;
  height: 100%;
  background: #f8fafc;
  border-right: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.25s ease;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.sasi-mode-tabs .nav-link {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  color: #475569;
  background: #e2e8f0;
  margin-right: 4px;
}
.sasi-mode-tabs .nav-link.active {
  background: #0f3460;
  color: #fff;
}

.sasi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
}

.context-card {
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  border-color: #bfdbfe;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.layer-chip input { display: none; }
.layer-chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.layer-chip.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.result-filter-pills {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding-bottom: 4px;
}
.res-pill {
  white-space: nowrap;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.res-pill.active {
  background: #0f3460;
  color: #fff;
  border-color: #0f3460;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0ea5e9;
  border-radius: 10px;
  padding: 10px 11px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.feat-card:hover {
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
  border-color: #94a3b8;
}
.feat-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  line-height: 1.25;
}
.feat-shp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 6px;
  border-radius: 5px;
  word-break: break-all;
}

.sasi-map-wrap {
  flex: 1;
  position: relative;
  height: 100%;
}
#map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.map-hud-coord {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 800;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.map-legend-box {
  position: absolute;
  bottom: 24px;
  right: 12px;
  z-index: 800;
  background: rgba(255,255,255,0.94);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 11.5px;
  line-height: 1.7;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.lg-line { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.lg-box { display: inline-block; width: 11px; height: 11px; border: 2px solid; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

.ctx-item {
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 5px;
}

@media (max-width: 991.98px) {
  .sasi-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 92vw;
    max-width: 400px;
    box-shadow: 6px 0 24px rgba(0,0,0,0.22);
  }
  .sasi-sidebar.collapsed {
    transform: translateX(-105%);
  }
}
